るりまサーチ

最速Rubyリファレンスマニュアル検索!
82件ヒット [1-82件を表示] (0.230秒)
トップページ > クエリ:_builtin[x] > クエリ:@[x] > クエリ:call[x] > クラス:Method[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

キーワード

検索結果

Method#call(*args) -> object (23133.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 (23133.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 (23127.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 (23127.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 (23121.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 (23121.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#<<(callable) -> Proc (8143.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 (8143.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#>>...

Method#curry -> Proc (8043.0)

self を元にカリー化した Proc を返します。

...す。

@
param arity 引数の個数を指定します。可変長の引数を指定できるメソッドを
カリー化する際には必ず指定する必要があります。

//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end

proc = self.method(:foo).curry
proc2 = proc.call(1, 2...
...) #=> #<Proc>
proc2.call(3) #=> [1,2,3]

def vararg(*args)
args
end

proc = self.method(:vararg).curry(4)
proc2 = proc.call(:x) #=> #<Proc>
proc3 = proc2.call(:y, :z) #=> #<Proc>
proc3.call(:a) #=> [:x, :y, :z, :a]
//}

@
see Proc#curry...

Method#curry(arity) -> Proc (8043.0)

self を元にカリー化した Proc を返します。

...す。

@
param arity 引数の個数を指定します。可変長の引数を指定できるメソッドを
カリー化する際には必ず指定する必要があります。

//emlist[例][ruby]{
def foo(a,b,c)
[a, b, c]
end

proc = self.method(:foo).curry
proc2 = proc.call(1, 2...
...) #=> #<Proc>
proc2.call(3) #=> [1,2,3]

def vararg(*args)
args
end

proc = self.method(:vararg).curry(4)
proc2 = proc.call(:x) #=> #<Proc>
proc3 = proc2.call(:y, :z) #=> #<Proc>
proc3.call(:a) #=> [:x, :y, :z, :a]
//}

@
see Proc#curry...

絞り込み条件を変える

Method#===(*args) -> object (8033.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#[](*args) -> object (8033.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#===(*args) -> object (8027.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#[](*args) -> object (8027.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#===(*args) -> object (8021.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#[](*args) -> object (8021.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#super_method -> Method | nil (8019.0)

self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。

...ッドを Method オブジェ
クトにして返します。

@
see UnboundMethod#super_method

//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end

class Sub < Super
def foo
"subclass method"
end
end

m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subc...
...lass method"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}...