クラス
- Data (4)
-
Enumerator
:: Lazy (11) -
Fiddle
:: Closure :: BlockCaller (11) - File (11)
-
Net
:: HTTP (22) - Proc (18)
-
Psych
:: Nodes :: Mapping (11) -
Psych
:: Nodes :: Sequence (11) -
RubyVM
:: InstructionSequence (33) -
Shell
:: ProcessController (6) - Struct (44)
- Thread (16)
モジュール
-
RubyVM
:: AbstractSyntaxTree (12) - URI (14)
オブジェクト
- ENV (12)
キーワード
- [] (11)
-
block
_ output _ synchronize (6) - blockdev? (11)
- define (4)
- disasm (11)
- disassemble (11)
- new (95)
- of (19)
- open (14)
- parse (4)
-
report
_ on _ exception (8) -
report
_ on _ exception= (8) - start (22)
-
to
_ h (12)
検索結果
先頭5件
- Shell
:: ProcessController . block _ output _ synchronize { . . . } -> () - File
. blockdev?(path) -> bool - Fiddle
:: Closure :: BlockCaller . new(ret , args , abi=Fiddle :: Function :: DEFAULT) { . . . } -> Fiddle :: Closure :: BlockCaller - Data
. define(*args) {|subclass| block } -> Class - Psych
:: Nodes :: Mapping . new(anchor=nil , tag=nil , implicit=true , style=BLOCK) -> Psych :: Nodes :: Mapping
-
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 オブジェクトを指定した...