別のキーワード
クラス
- Array (60)
- Class (24)
- Complex (36)
- Data (21)
- Dir (414)
- Encoding (108)
-
Encoding
:: Converter (72) - Enumerator (25)
-
Enumerator
:: Chain (7) -
Enumerator
:: Lazy (12) - Exception (24)
- Fiber (28)
- File (456)
-
File
:: Stat (12) - FrozenError (14)
- Hash (66)
- IO (192)
- Integer (12)
- KeyError (28)
- Module (60)
- Object (12)
- Proc (19)
- Random (77)
- Range (12)
- Regexp (96)
- RubyVM (1)
-
RubyVM
:: InstructionSequence (116) - Set (9)
- SignalException (36)
- String (43)
- Struct (64)
- Symbol (12)
- SystemCallError (12)
- Thread (60)
-
Thread
:: Queue (8) - ThreadGroup (12)
- Time (192)
- TracePoint (24)
モジュール
- GC (108)
-
GC
:: Profiler (48) - Process (8)
-
RubyVM
:: AbstractSyntaxTree (30) -
RubyVM
:: MJIT (21) - Warning (10)
キーワード
- === (12)
- DEBUG (12)
- DEBUG= (12)
- [] (81)
- []= (12)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) -
absolute
_ path (12) -
absolute
_ path? (6) - aliases (12)
-
all
_ symbols (12) -
asciicompat
_ encoding (24) - at (53)
- atime (12)
- basename (12)
- binread (12)
- binwrite (12)
- birthtime (11)
- bytes (7)
- categories (1)
- chdir (48)
- children (16)
- chown (12)
- chroot (12)
- clear (12)
- clone (12)
- compatible? (12)
- compile (24)
-
compile
_ file (12) -
compile
_ option (12) -
compile
_ option= (12) - constants (12)
-
copy
_ stream (24) - count (12)
- ctime (12)
- current (4)
-
default
_ external (12) -
default
_ external= (12) -
default
_ internal= (12) - define (6)
- delete (48)
-
delete
_ if (24) - dirname (12)
- disable (12)
- disasm (12)
- disassemble (12)
- each (24)
-
each
_ child (32) -
each
_ key (24) -
each
_ pair (24) - empty? (9)
- enable (12)
- enabled? (7)
- entries (24)
- escape (12)
- except (4)
- exception (12)
- exist? (12)
- exists? (18)
- extname (12)
- find (12)
- fnmatch (12)
- fnmatch? (12)
-
for
_ fd (12) - foreach (72)
- ftype (12)
- getwd (12)
- glob (24)
- gm (24)
- home (24)
- include (12)
- join (12)
-
keyword
_ init? (4) -
last
_ match (24) -
last
_ status (8) -
latest
_ gc _ info (24) - lchmod (12)
- lchown (12)
- link (12)
- list (12)
-
load
_ from _ binary (10) -
load
_ from _ binary _ extra _ data (10) - local (24)
-
locale
_ charmap (12) - lstat (12)
- members (15)
- mkdir (12)
- mkfifo (10)
- mktime (24)
- mtime (12)
-
name
_ list (12) - nesting (12)
- new (565)
-
new
_ seed (12) - now (12)
- of (22)
- open (96)
- parse (10)
-
parse
_ file (10) - path (12)
- pause (7)
- polar (12)
- produce (6)
- pwd (12)
- quote (12)
- rand (36)
-
raw
_ data (12) -
raw
_ seed (2) - readlines (36)
- readlink (12)
- realpath (12)
- rect (12)
- rectangular (12)
- reject (24)
- reject! (24)
- rename (12)
- report (12)
-
resolve
_ feature _ path (1) - result (12)
- resume (7)
- rmdir (12)
-
ruby2
_ keywords _ hash? (6) -
search
_ convpath (12) - slice (7)
- split (12)
- sqrt (8)
- start (12)
- stat (36)
- stop (12)
- store (12)
- stress= (12)
- symlink (12)
- sysopen (12)
-
to
_ h (14) -
total
_ time (12) - trace (12)
- truncate (12)
-
try
_ convert (52) - umask (24)
- union (12)
- unlink (24)
- urandom (8)
-
used
_ modules (12) - using (12)
- utc (24)
- utime (12)
- warn (9)
-
world
_ readable? (12) -
world
_ writable? (12) - write (24)
- yield (12)
検索結果
先頭5件
- Hash
. ruby2 _ keywords _ hash?(hash) -> bool - RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence - RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence - RubyVM
:: AbstractSyntaxTree . parse(string) -> RubyVM :: AbstractSyntaxTree :: Node - RubyVM
:: AbstractSyntaxTree . parse(string , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node
-
Hash
. ruby2 _ keywords _ hash?(hash) -> bool (6194.0) -
Module#ruby2_keywordsやProc#ruby2_keywordsによる ruby2_keywords フラグが設定されているかどうかを返します。
...Module#ruby2_keywordsやProc#ruby2_keywordsによる
ruby2_keywords フラグが設定されているかどうかを返します。
このメソッドはデバッグや調査、シリアライゼーションのために本当に必要な場合のために
用意されていて、普通のプログ......れていません。
ruby 2.7.1 で追加されたため、ruby 2.7.0 では定義されていません。
//emlist[][ruby]{
ruby2_keywords def foo(*args)
Hash.ruby2_keywords_hash?(args.last)
end
foo(k: 1) # => true
foo({k: 1}) # => false
//}
@see Module#ruby2_keywords, Proc#ruby2_keywords... -
RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (3125.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 source で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定しま......れかで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (3125.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 source で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定しま......れかで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
RubyVM
:: AbstractSyntaxTree . parse(string) -> RubyVM :: AbstractSyntaxTree :: Node (3121.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...ドを返します。
@param string パースする対象の Ruby のコードを文字列で指定します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9......文字列を抽象構文木にパースし、その木の根ノードを返します。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコ......あるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# bo......dy:
# (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 (L... -
RubyVM
:: AbstractSyntaxTree . parse(string , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (3121.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...文字列を抽象構文木にパースし、その木の根ノードを返します。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコ......あるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# bo......dy:
# (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 (L... -
RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence (3119.0) -
引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 file で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
RubyVM::InstructionSequence.compile とは異なり、file、path などの
メタデータは自動的に取得します。
@param......細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
# /tmp/hello.rb
puts "Hello, world!"
# irb
RubyVM::InstructionSequence.compile_file("/tmp/hello.rb")
# => <RubyVM::InstructionSequence:<main>@/tmp/hello.rb>
@see RubyVM::Inst... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname) -> RubyVM :: AbstractSyntaxTree :: Node (3115.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...のファイルパスを指定します
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# bo......dy:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file (LIST@1:41-1:49 (STR@1:41-1:49 "") nil)) nil)))
//}......換えてツリーを生成します。
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# bo... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (3115.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...換えてツリーを生成します。
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# bo......dy:
# (FCALL@1:0-1:50 :pp
# (LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file (LIST@1:41-1:49 (STR@1:41-1:49 "") nil)) nil)))
//}... -
RubyVM
:: AbstractSyntaxTree . of(proc) -> RubyVM :: AbstractSyntaxTree :: Node (3109.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...す。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-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::AbstractSyntaxT... -
RubyVM
:: AbstractSyntaxTree . of(proc , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (3109.0) -
引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。
...す。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-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::AbstractSyntaxT... -
RubyVM
:: InstructionSequence . load _ from _ binary(binary) -> RubyVM :: InstructionSequence (3109.0) -
RubyVM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。
...
RubyVM::InstructionSequence#to_binaryにより作られたバイナリフォーマットの文字列からiseqのオブジェクトをロードします。
このローダーは検証機構をもっておらず、壊れたり改変されたバイナリを読み込むと深刻な問題を引き起......りません。自分が変換したバイナリデータを使うべきです。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary
RubyVM::InstructionSequence.load_from_binary(binary).eval # => 3
//}
@see RubyVM::InstructionSequence#to_binary... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (3103.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
...クトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequence.of(p)
> # => <RubyVM::InstructionSe......quence:block in irb_binding@(irb)>
# method
> def foo(bar); puts bar; end
> RubyVM::InstructionSequence.of(method(:foo))
> # => <RubyVM::InstructionSequence:foo@(irb)>
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/iseq_of.rb
def hello
puts "hello, wor......rb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_global_proc)
> # => #<RubyVM::InstructionSequence:0x007fb73d7caf78>......irb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_global_proc)
> # => #<RubyVM::InstructionSequence:0x007fb73d7caf78>... -
RubyVM
. resolve _ feature _ path (3037.0) -
require を呼んだときに読み込まれるファイルを特定します。 このメソッドはRuby 2.7 で $LOAD_PATH の特異メソッドに移動しました。
...require を呼んだときに読み込まれるファイルを特定します。
このメソッドはRuby 2.7 で $LOAD_PATH の特異メソッドに移動しました。
//emlist[][ruby]{
p RubyVM.resolve_feature_path('set')
# => [:rb, "/build-all-ruby/2.6.0/lib/ruby/2.6.0/set.rb"]
//}... -
RubyVM
:: InstructionSequence . compile _ option -> Hash (3009.0) -
命令シーケンスのコンパイル時のデフォルトの最適化オプションを Hash で返 します。
...命令シーケンスのコンパイル時のデフォルトの最適化オプションを Hash で返
します。
//emlist[例][ruby]{
require "pp"
pp RubyVM::InstructionSequence.compile_option
# => {:inline_const_cache=>true,
# :peephole_optimization=>true,
# :tailcall_optimization=>false,
# :......>true,
# :operands_unification=>true,
# :instructions_unification=>false,
# :stack_caching=>false,
# :trace_instruction=>true,
# :frozen_string_literal=>false,
# :debug_frozen_string_literal=>false,
# :coverage_enabled=>true,
# :debug_level=>0}
//}
@see RubyVM::InstructionSequence.compile_option=...