るりまサーチ

最速Rubyリファレンスマニュアル検索!
114件ヒット [1-100件を表示] (0.089秒)
トップページ > クエリ:object[x] > クエリ:nil[x] > クエリ:lambda[x]

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object to_enum
  5. object public_send

検索結果

<< 1 2 > >>

Kernel.#lambda -> Proc (18234.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
//}

d:spec/ca...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

Kernel.#lambda { ... } -> Proc (18234.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
//}

d:spec/ca...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

Kernel.#proc -> Proc (3134.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
//}

d:spec/ca...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

Kernel.#proc { ... } -> Proc (3134.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> wrong number of arguments (2 for 3) (ArgumentError)
//}

d:spec/ca...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

Kernel.#proc -> Proc (3133.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

絞り込み条件を変える

Kernel.#proc { ... } -> Proc (3133.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...うけるべきです。

ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを...
...mentError (tried to create Proc object without a block)
が発生します。

@raise ArgumentError スタック上にブロックがないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda
(&block)
end

it = foo{p 12}
it...
...ていてもエラーにならない][ruby]{
b = Proc.new{|a,b,c|
p a,b,c
}
b.call(2, 4)
#=> 2
4
nil

//}

//emlist[lambda は引数の数が違うとエラーになる][ruby]{
b = lambda{|a,b,c|
p a,b,c
}
b.call(2, 4)
# => wrong number of arguments (given 2, expected 3)
//}

d:spec/call#...

1.6.8から1.8.0への変更点(まとめ) (822.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)

追加された -W オプションは $VERBOSE = nil の指定(-W0)を...
...スは特異クラス自身であると定義されました
((<ruby-bugs-ja:313>))。なんだかよくわかりません(^^;

class << Object
p [self.id, self]
class << self
p [self.id, self]
end
end
=> ruby 1.6.7 (2002-03-01) [i5...
...ss:Object>]
[537771634, #<Class:Object>]

((<ruby-bugs-ja:336>)) のあたりでまた少し変わったかもしれません
(2002-09-21 の ChangeLog 参照。まじめにおっかけるのに疲れたらしい
^^;;)

: ((<Proc/Proc.new>)) [change]
: ((<組み込み関数/lambda>)...

Proc#parameters(lambda: nil) -> [object] (357.0)

Proc オブジェクトの引数の情報を返します。

...k
& で指定されたブロック引数

@param lambda true なら lambda として扱ったとき、false なら lambda ではない Proc として
扱ったときの引数の情報を返します。

//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}...
...[:block, :b
//}

//emlist[lambda: の例][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters(lambda: true) # => x], [:opt, :y...
...], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters(lambda: false) # => x], [:opt, :y], [:rest, :other
//}

@see Method#parameters, UnboundMethod#parameters...

irb (180.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...nf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:MATH_MODE] = false
IRB.c...
...# サブ irb を起動
irb#1(main):001:0> x # x を表示
NameError: undefined local variable or method `x' for main:Object
from (irb#1):1:in `Kernel#binding'

起動時のインタプリタでローカル変数 x を定義しましたが、
「irb」でサブ irb...
...irb の設定をまとめて設定することができます。

以下に例を示します。

$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc:0x00002a95fa3fd8@(irb):2>
irb(main):002:0> irb
>

=== irb の使用例

irb のいろいろな使用...
...nf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:PROMPT] = {....}
IRB.con...

NEWS for Ruby 2.7.0 (138.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...で**nilと書くことで、このメソッドがキーワードを
受け取らないことを明示できるようになりました。このようなメソッドを
キーワード引数付きで呼び出すとArgumentErrorになります。 14183

//emlist[][ruby]{
def foo(h, **nil); en...
...rning: `_1' is reserved for numbered parameter; consider another name
[1].each { p _1 } # prints 0 instead of 1

==== ブロックなしの proc/lambda が deprecated

* ブロック付きで呼び出されたメソッドの中で、ブロックなしでProc.newやKernel#procを
呼び出す...
...きで呼び出されたメソッドの中で、Kernel#lambdaをブロックなしで呼び出すと
例外が発生するようになりました。

//emlist[][ruby]{
def bar
lambda

end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}

==== その他...

絞り込み条件を変える

NEWS for Ruby 2.1.0 (96.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}

* def によるメソッド定義式は nil の代わりにメソッド名をシンボルで返します

=== 組み込みクラスの更新

* Array
* 追加: Array#to_h キーと値の...
...すためにキーワード引数 `exception: false` を受け付けるようになりました

* Kernel
* 追加: Kernel#singleton_method(Object#singleton_method)

* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or mo...
...TypeError を発生させるようになりました。

* Proc
* Returning from lambda proc now always exits from the Proc, not from the
method where the lambda is created. Returning from non-lambda proc exits
from the method, same as the former behavior.

* String
* 以...

ruby 1.9 feature (66.0)

ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。

...した
[RCR#331]

=== 2006-06-22

: Module#name

無名モジュールに対しては nil を返すようになりました
[ruby-talk:198440]

=== 2006-06-17

: BasicObject#invoke_method
: BasicObject#invoke_functional_method

追加
((<ruby-talk:197512>))

=== 2006-06-13

: IPsocket
: TC...
..._method__ [new]

((<URL:http://www.dm4lab.to/~usa/ruby/d/200606a.html#id20060610_P1_7>))

: Symbol#to_proc

=== 2006-06-10

* 新機能
: BasicObject が導入されました [new]
: local という visibility および Module#local, Module#local_methods というメソッドが導入されま...
...るようになりました

* obsolete 要素、実験要素除去
: 実験中だった meth -> { ... } という -> が除去されました (lambda のかわりの -> { ... } は残っています)
: 実験中だった ;; が除去されました
: いくらか obsolete な構文が除去...

メソッド呼び出し(super・ブロック付き・yield) (60.0)

メソッド呼び出し(super・ブロック付き・yield) * super * block * yield * block_arg * numbered_parameters * call_method

...メソッドを呼びだそうとすると、レシーバが nil の場合は
以下のように働きます。

* 引数の評価が行なわれない
* メソッド呼び出しが行われない
* nil を返す

レシーバが nil でない場合は通常のメソッド呼び出しが行わ...
...) do [`|' 式 ... `|'] 式 ... end
method(arg1, arg2, ...) `{' [`|' 式 ... `|'] 式 ... `}'
method(arg1, arg2, ..., `&' proc_object)

ブロック付きメソッドとは制御構造の抽象化のために用いられる
メソッドです。最初はループの抽象化の...
...実行が中断された場合は nil
を返します。

next に引数を指定した場合はその値が yield の戻り値になります。

====[a:block_arg] ブロックパラメータの挙動


メソッド呼び出しと挙動が異なります。
lambda
でないブロックを呼び出...

NEWS for Ruby 3.0.0 (54.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...* Kernel#eval when called with two arguments will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352
* Kernel#lambda now warns if called without a literal block. 15973
* Kernel.sleep invokes the scheduler hook `#kernel_sleep(...)` in a non-blocking execution...
...s a symbol. 17314

//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}

* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially all...
...* Now `{ a: 1 }.each(&->(k, v) { })` raises an ArgumentError due to lambda's arity check.
* When writing to STDOUT redirected to a closed pipe, no broken pipe error message will be shown now. 14413
* `TRUE`/`FALSE`/`NIL` constants are no longer defined.
* Integer#zero? overrides Numeric#...

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (36.0)

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or  plus minus ast slash hat sq  period comma langl rangl eq tilde  dollar at under lbrarbra  lbra2rbra2 lbra3rbra3 dq colon ac  backslash semicolon

...をブロックとして使う。d:spec/call#block を参照。

: xxx&.yyy

safe navigation operator(通称「ぼっち演算子」)。xxx が nil でないときにメソッドyyyを呼び出す。spec/call を参照。

===[a:or] |

: 3 | 5

論理和演算子または類似のメソッド...
...。d:spec/variables#const を参照。

: ::DateTime

定数のスコープ演算子で、トップレベルの定数であることを示す。Object クラスで
定義されている定数(トップレベルの定数と言う)を確実に参照するためには
d:spec/variables#const を参...
... lambda の新しい記法。以下と同じ。
//emlist{
lambda
{|a, b| p [a, b] }
//}


===[a:eq] =

: a = 12

代入演算子。

: xxx.a = 12

代入メソッドの呼び出し。

: a == 12

等号演算子。または類似のメソッド。

: a === 12

特殊な等号演算子。Object#==...

絞り込み条件を変える

<< 1 2 > >>