48件ヒット
[1-48件を表示]
(0.086秒)
ライブラリ
- ビルトイン (48)
クラス
-
ARGF
. class (12) - Method (12)
- Object (12)
-
Thread
:: Backtrace :: Location (12)
検索結果
先頭4件
-
ARGF
. class # puts(*arg) -> nil (21114.0) -
引数と改行を順番に処理対象のファイルに出力します。 引数がなければ改行のみを出力します。
...力します。
引数がなければ改行のみを出力します。
c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#puts と同じです。
@param arg 出力するオブジェクトを任意個指定します。... -
Method
# owner -> Class | Module (148.0) -
このメソッドが定義されている class か module を返します。
...定義されている class か module を返します。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.owner # => Foo
m = Foo.new.method(:puts) # => #<Method: Foo(Kernel)#puts>
m.owner # => Kernel
//}... -
Object
# to _ s -> String (55.0) -
オブジェクトの文字列表現を返します。
...
Kernel.#print や Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。
//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)
puts it #=> #<Foo:0x2b69110>
class Foo......def to_s
"Class:Foo Number:#{@num}"
end
end
puts it #=> Class:Foo Number:40
//}
@see Object#to_str,Kernel.#String... -
Thread
:: Backtrace :: Location # to _ s -> String (29.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => pat...