1022件ヒット
[501-600件を表示]
(0.070秒)
ライブラリ
モジュール
キーワード
- BMPString (24)
- BitString (24)
- Float (12)
- GeneralString (24)
- GraphicString (24)
- IA5String (24)
- ISO64String (24)
- Integer (12)
- NumericString (24)
- OctetString (24)
- PrintableString (24)
- T61String (24)
- UTF8String (24)
- UniversalString (24)
- VideotexString (24)
- ` (12)
- abbrev (12)
-
allocation
_ sourcefile (12) - argv0 (12)
- autoload (12)
- autoload? (12)
- caller (36)
- chomp (12)
- chop (12)
- confstr (12)
-
count
_ objects _ size (12) - dump (36)
- encode64 (12)
-
fast
_ generate (12) -
fast
_ unparse (12) - format (12)
- generate (12)
- getlogin (12)
- gets (12)
- gsub (36)
- h (12)
- hexencode (12)
-
html
_ escape (12) - isjis (12)
- load (12)
- open (2)
- pipeline (12)
-
pretty
_ generate (12) -
pretty
_ unparse (12) - readline (24)
- readlines (12)
- restore (12)
- setproctitle (12)
- sprintf (12)
- sub (24)
- sysconfdir (12)
- systmpdir (12)
-
trace
_ var (36) - trap (24)
- u (12)
- uname (12)
- unparse (12)
-
untrace
_ var (12) -
url
_ encode (12) -
urlsafe
_ encode64 (12)
検索結果
先頭5件
-
Kernel
. # caller(start = 1) -> [String] | nil (243.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...囲を示す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'",......nil
//}
以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。
//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end......=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
Kernel
. # caller(start , length) -> [String] | nil (243.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...囲を示す Range オブジェクトを指定します。
@see Kernel.#set_trace_func,Kernel.#raise,
Kernel.#caller_locations
//emlist[例][ruby]{
def foo
p caller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'",......nil
//}
以下の関数は、caller の要素から [ファイル名, 行番号, メソッド名]
を取り出して返します。
//emlist[例][ruby]{
def parse_caller(at)
if /^(.+?):(\d+)(?::in `(.*)')?/ =~ at
file = $1
line = $2.to_i
method = $3
[file, line, method]
end
end......=> ["-", 15, "bar"]
# ["-", 19, nil]
# nil
//}
以下は、$DEBUG が真の場合に役に立つ debug 関数
のサンプルです。
//emlist[例][ruby]{
$DEBUG = true
def debug(*args)
p [caller.first, *args] if $DEBUG
end
debug "debug information"
#=> ["-:7", "debug information"]
//}... -
ERB
:: Util . # u(s) -> String (241.0) -
文字列 s を URLエンコードした文字列を返します。
...を返します(CGI.escapeとほぼ同じです)。
@param s URLエンコードを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
//}... -
ERB
:: Util . # url _ encode(s) -> String (241.0) -
文字列 s を URLエンコードした文字列を返します。
...を返します(CGI.escapeとほぼ同じです)。
@param s URLエンコードを行う文字列
//emlist[例][ruby]{
require "erb"
include ERB::Util
puts url_encode("Programming Ruby: The Pragmatic Programmer's Guide")
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
//}... -
Etc
. # sysconfdir -> String | nil (239.0) -
システムの設定ディレクトリを返します。
...レクトリを返します。
//emlist[][ruby]{
require 'etc'
p Etc.sysconfdir # => "/etc"
//}
主に "/etc" を返しますが、Ruby をソースからビルドした場合は異なるディレ
クトリを返す場合があります。例えば、Ruby を /usr/local にインストールし... -
Kernel
. # `(command) -> String (239.0) -
command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。
...で返します。
@raise Errno::EXXX コマンドを実行できないときや失敗した場合に発生します。
//emlist[例][ruby]{
puts `ruby -v` #=> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
puts $?.inspect #=> #<Process::Status: pid=3580,exited(0)>
//}
@see Kernel.#system,Ker... -
Kernel
. # gets(rs = $ / ) -> String | nil (239.0) -
ARGFから一行読み込んで、それを返します。 行の区切りは引数 rs で指定した文字列になります。
...り(EOF)に到達した時、 nil を返します。
@raise Errno::EXXX 読み込みに失敗した場合に発生します。
//emlist[main.rb][ruby]{
ARGV << 'b.txt' << 'c.txt'
p gets #=> "hello\n"
p gets(nil) #=> "it\ncommon\n"
p gets("") #=> "ARGF\n\n"
p gets('、') #=> "# スクリプトに指......イルを表すオブジェクトです。\n"
p gets #=> nil
p readline # end of file reached (EOFError)
//}
//emlist[b.txt][ruby]{
hello
it
common
//}
//emlist[c.txt][ruby]{
ARGF
# スクリプトに指定した引数 (Object::ARGV を参照) をファイル名と
# みなして、それらの... -
Kernel
. # gsub(pattern) {|matched| . . . } -> String (229.0) -
$_.gsub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "test\n"
gsub(/es/, '!!') # => "t!!t\n"
//}
@see String#gsub,$_... -
Kernel
. # gsub(pattern , replace) -> String (229.0) -
$_.gsub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "test\n"
gsub(/es/, '!!') # => "t!!t\n"
//}
@see String#gsub,$_...