るりまサーチ

最速Rubyリファレンスマニュアル検索!
483件ヒット [1-100件を表示] (0.085秒)
トップページ > クエリ:Ruby[x] > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:@[x] > クエリ:call[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Method#call(*args) -> object (15147.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called...

Method#call(*args) { ... } -> object (15147.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...


@
param args self に渡される引数。

@
see UnboundMethod#bind_call
@
see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called...

Method#call(*args) -> object (15141.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...せん。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2...

Method#call(*args) { ... } -> object (15141.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...せん。


@
param args self に渡される引数。

@
see UnboundMethod#bind_call

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2...

Proc#call(*arg) -> () (15140.0)

手続きオブジェクトを実行してその結果を返します。

...す。

//emlist[例][ruby]{
def sign(n)
case n
when lambda{|n| n > 0} then 1
when lambda{|n| n < 0} then -1
else 0
end
end

p sign(-4) #=> -1
p sign(0) #=> 0
p sign(7) #=> 1
//}

また、以下のような syntactic sugar もあります。

//emlist[例][ruby]{
fib = lambda{|n|
case...
...n
when 0 then 0
when 1 then 1
else
fib.(n - 2) + fib.(n - 1)
end
}
fib.(10) # => 55
//}



@
param arg 手続きオブジェクトに与える引数を指定します。

@
raise LocalJumpError Procを生成したメソッドからリターンしてしまった場合に発生します。...

絞り込み条件を変える

Method#call(*args) -> object (15135.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...りません。


@
param args self に渡される引数。

@
see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
/...

Method#call(*args) { ... } -> object (15135.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...りません。


@
param args self に渡される引数。

@
see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
/...

UnboundMethod#bind_call(recv, *args) -> object (6141.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@
see UnboundMethod#bind, Method#call...

UnboundMethod#bind_call(recv, *args) { ... } -> object (6141.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@
see UnboundMethod#bind, Method#call...

TracePoint#callee_id -> Symbol | nil (6133.0)

イベントが発生したメソッドの呼ばれた名前を Symbol で返します。 トップレベルであった場合は nil を返します。

...は nil を返します。

@
raise RuntimeError イベントフックの外側で実行した場合に発生します。

//emlist[][ruby]{
class C
def method_name
end
alias alias_name method_name
end

trace = TracePoint.new(:call) do |tp|
p [tp.method_id, tp.callee_id] # => [:method_name, :...
...alias_name]
end
trace.enable do
C.new.alias_name
end
//}

@
see TracePoint#method_id...

絞り込み条件を変える

Method#<<(callable) -> Proc (193.0)

self と引数を合成した Proc を返します。

...まず受け取った引数を callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します。

Method#>> とは呼び出しの順序が逆になります。

@
param callable Proc、Method、もしくは任意の call メソッドを持ったオブジ...
...* (3 + 3)
p (method(:f) << method(:g)).call(3) # => 36
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = method(:pp) << WordSc...
...anner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@
see Proc#<<, Proc#>>...

Method#>>(callable) -> Proc (193.0)

self と引数を合成した Proc を返します。

...し、
その戻り値を callable に渡して呼び出した結果を返します。

Method#<< とは呼び出しの順序が逆になります。

@
param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。

//emlist[例][ruby]{
def f(x)
x * x
end...
...+ (3 * 3)
p (method(:f) >> method(:g)).call(3) # => 18
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = File.method(:read) >>...
...WordScanner >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@
see Proc#<<, Proc#>>...

Proc#>>(callable) -> Proc (193.0)

self と引数を合成した Proc を返します。

...し、
その戻り値を callable に渡して呼び出した結果を返します。

Proc#<< とは呼び出しの順序が逆になります。

@
param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。

//emlist[例][ruby]{
f = proc { |x| x * x }
g...
...x + x }

# (3 * 3) + (3 * 3)
p (f >> g).call(3) # => 18
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = proc { |fname| File.r...
...ead(fname) } >> WordScanner >> method(:p)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@
see Method#<<, Method#>>...

Proc#<<(callable) -> Proc (181.0)

self と引数を合成した Proc を返します。

... callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します。

Proc#>> とは呼び出しの順序が逆になります。

@
param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。

//emlist[例][ruby...
...x + x }

# (3 + 3) * (3 + 3)
p (f << g).call(3) # => 36
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = proc { |data| puts "w...
...ord count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}

@
see Method#<<, Method#>>...

BasicObject#instance_eval {|obj| ... } -> object (87.0)

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。

...るメソッドは見えません。
これは、トップレベルの定数が Object 以下に作成されるためです。

@
param expr 評価する文字列です。

@
param filename 文字列を指定します。ファイル filename に文字列 expr が
書かれているか...
...

@
param lineno 整数を指定します。行番号 lineno から文字列 expr が書かれているかのように実行されます。
スタックトレースの表示などを差し替えることができます。

//emlist[例][ruby]{
class Foo
def initialize data
@
key...
...eval{p @key} #=> "XXX"
some.instance_eval{do_fuga } #=> "secret" # private メソッドも呼び出せる

some.instance_eval 'raise' # ..:10: (eval):1: (RuntimeError)
messg = 'unknown'
some.instance_eval 'raise messg','file.rb',999 # file.rb:999: unknown (RuntimeError)
//}

//emlist[例][ruby]{
cl...

絞り込み条件を変える

<< 1 2 3 ... > >>