るりまサーチ

最速Rubyリファレンスマニュアル検索!
34件ヒット [1-34件を表示] (0.144秒)

別のキーワード

  1. _builtin all?
  2. pop delete_all
  3. pop3 delete_all
  4. net/pop delete_all
  5. pop all

ライブラリ

キーワード

検索結果

Method#call(*args) -> object (3120.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 (3120.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 (3114.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"
/...
...せん。


@
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 (3114.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"
/...
...せん。


@
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#<<(callable) -> Proc (114.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) << WordS...
...canner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

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

絞り込み条件を変える

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

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

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

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

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

//emlist[例]...
...(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) >> W...
...ordScanner >> method(:pp)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

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