るりまサーチ

最速Rubyリファレンスマニュアル検索!
236件ヒット [1-100件を表示] (0.077秒)
トップページ > クエリ:-[x] > クエリ:BLOCK[x] > 種類:特異メソッド[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 > >>

Shell::ProcessController.block_output_synchronize { ... } -> () (6202.0)

@todo

@todo

File.blockdev?(path) -> bool (6201.0)

FileTest.#blockdev? と同じです。

...FileTest.#blockdev? と同じです。

@param path パスを表す文字列か IO オブジェクトを指定します。


@see FileTest.#blockdev?...

Fiddle::Closure::BlockCaller.new(ret, args, abi=Fiddle::Function::DEFAULT) { ... } -> Fiddle::Closure::BlockCaller (3201.0)

Ruby のブロックを呼び出す Fiddle::Closure オブジェクトを返します。

Ruby のブロックを呼び出す Fiddle::Closure オブジェクトを返します。


args、ret で関数の引数と返り値の型を指定します。
指定は Fiddle::Function.new と同様なので、そちら
を参照してください。

@param ret 返り値の型
@param args 引数の型を表す配列
@param abi 呼出規約

Data.define(*args) {|subclass| block } -> Class (214.0)

Data クラスに新しいサブクラスを作って、それを返します。

...TPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end

p fetch("http://example.com/") # => "Current time is 2023-01-10 10:00:53 +0900"
p fetch("http://example.com/404") # => :NotFound
//}

@param args 値オブジェクトのクラスを定義するための可...

Psych::Nodes::Mapping.new(anchor=nil, tag=nil, implicit=true, style=BLOCK) -> Psych::Nodes::Mapping (208.0)

新たな mapping オブジェクトを生成します。

...上の style を整数で指定します。以下のいずれ
かを指定できます。
* Psych::Nodes::Mapping::ANY
* Psych::Nodes::Mapping::BLOCK
* Psych::Nodes::Mapping::FLOW

@param anchor mapping に付加された anchor
@param tag mapping に付加された tag
@param implicit mapping...

絞り込み条件を変える

Psych::Nodes::Sequence.new(anchor=nil, tag=nil, implicit=true, style=BLOCK) -> Psych::Nodes::Sequence (208.0)

新たな sequence オブジェクトを生成します。

...の style を整数で指定します。以下のいずれ
かを指定できます。
* Psych::Nodes::Sequence::ANY
* Psych::Nodes::Sequence::BLOCK
* Psych::Nodes::Sequence::FLOW

@param anchor sequence に付加された anchor
@param tag sequence に付加された tag
@param implicit seque...

ENV.to_h {|name, value| block } -> Hash (202.0)

環境変数の名前をキーとし、対応する値をもつハッシュを返します。

環境変数の名前をキーとし、対応する値をもつハッシュを返します。

ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
ENV.to_h {|name, value| [name, value.size] }
//}

Struct.new(*args) {|subclass| block } -> Class (202.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...以下のような指定はエラーになります。

//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}

また args[1..-1] は、Symbol か String で指定します。

//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =...

Struct.new(*args, keyword_init: false) {|subclass| block } -> Class (202.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...以下のような指定はエラーになります。

//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}

また args[1..-1] は、Symbol か String で指定します。

//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =...

Struct.new(*args, keyword_init: nil) {|subclass| block } -> Class (202.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...以下のような指定はエラーになります。

//emlist[例][ruby]{
p Struct.new('foo', 'bar')
# => -:1:in `new': identifier foo needs to be constant (NameError)
//}

また args[1..-1] は、Symbol か String で指定します。

//emlist[例][ruby]{
p Struct.new("Foo", :foo, :bar) # =...

絞り込み条件を変える

RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node (185.0)

文字列を抽象構文木にパースし、その木の根ノードを返します。

...1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPCALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
# => (SCOPE@1:0-1:15
# tbl: [:x, :...
...y]
# args: nil
# body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))))
//}...

RubyVM::AbstractSyntaxTree.parse(string, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node (185.0)

文字列を抽象構文木にパースし、その木の根ノードを返します。

...1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPCALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
# => (SCOPE@1:0-1:15
# tbl: [:x, :...
...y]
# args: nil
# body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))))
//}...

RubyVM::AbstractSyntaxTree.of(proc) -> RubyVM::AbstractSyntaxTree::Node (167.0)

引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。

...8-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))

def hello
puts "hello, world"
end

pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5...
...pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)
# body:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") nil)))
//}...

RubyVM::AbstractSyntaxTree.of(proc, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node (167.0)

引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。

...8-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))

def hello
puts "hello, world"
end

pp RubyVM::AbstractSyntaxTree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5...
...pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)
# body:
# (FCALL@6:2-6:21 :puts (LIST@6:7-6:21 (STR@6:7-6:21 "hello, world") nil)))
//}...

Proc.new -> Proc (125.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、このメ...
...ArgumentError が発生します。

//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェ...

絞り込み条件を変える

Proc.new { ... } -> Proc (125.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。

ブロックを指定しなければ、このメ...
...ArgumentError が発生します。

//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェ...

RubyVM::InstructionSequence.disasm(body) -> String (125.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

...e:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 cont: 0012
|------------------------------------------------------------------------
local table (size: 2, argc: 0 [opts: 0, rest: -1...
..., post: 0, block: -1] s1)
[ 2] num
0000 trace 1 ( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 dup
0009 setlocal num, 0
0012 leave

例2:Method オブジェクトを指定した...
<< 1 2 3 > >>