クラス
- Array (60)
- Class (24)
- Complex (36)
- Data (21)
- Dir (414)
- Encoding (60)
-
Encoding
:: Converter (72) - Enumerator (25)
-
Enumerator
:: Chain (7) -
Enumerator
:: Lazy (12) - Exception (24)
- Fiber (28)
- File (347)
- FrozenError (14)
- Hash (30)
- IO (192)
- Integer (12)
- KeyError (28)
- Proc (19)
- Random (77)
- Range (12)
- Regexp (96)
- RubyVM (1)
-
RubyVM
:: InstructionSequence (116) - Set (3)
- SignalException (24)
- String (43)
- Struct (64)
- SystemCallError (12)
- Thread (60)
-
Thread
:: Queue (8) - ThreadGroup (12)
- Time (112)
- TracePoint (24)
モジュール
- GC (72)
-
GC
:: Profiler (48) - Process (8)
-
RubyVM
:: AbstractSyntaxTree (30) -
RubyVM
:: MJIT (21) - Warning (10)
オブジェクト
- ENV (180)
キーワード
- === (12)
- DEBUG (12)
- DEBUG= (12)
- [] (69)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (12) -
absolute
_ path (12) -
asciicompat
_ encoding (24) - basename (12)
- binread (12)
- binwrite (12)
- birthtime (11)
- bytes (7)
- categories (1)
- chdir (48)
- children (16)
- chown (12)
- chroot (12)
- clear (12)
- clone (12)
- compile (24)
-
compile
_ file (12) -
compile
_ option (12) -
compile
_ option= (12) -
copy
_ stream (24) - count (12)
- current (4)
-
default
_ external (12) -
default
_ external= (12) -
default
_ internal= (12) - define (6)
- delete (48)
-
delete
_ if (12) - dirname (12)
- disasm (12)
- disassemble (12)
- each (12)
-
each
_ child (32) -
each
_ key (12) -
each
_ pair (24) - empty? (9)
- enabled? (7)
- entries (24)
- escape (12)
- exception (12)
- exist? (12)
- exists? (9)
- extname (12)
- fnmatch (12)
- fnmatch? (12)
-
for
_ fd (12) - foreach (72)
- ftype (12)
- getwd (12)
- glob (24)
- gm (24)
- home (24)
- join (12)
-
keyword
_ init? (4) -
last
_ match (24) -
last
_ status (8) -
latest
_ gc _ info (12) - lchmod (12)
- lchown (12)
-
load
_ from _ binary (10) -
load
_ from _ binary _ extra _ data (10) - local (24)
-
locale
_ charmap (12) - members (15)
- mkdir (12)
- mktime (24)
-
name
_ list (12) - new (460)
-
new
_ seed (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) - split (12)
- sqrt (8)
- start (12)
- stat (24)
- stop (12)
- store (12)
- stress= (12)
- sysopen (12)
-
total
_ time (12) - trace (12)
- truncate (12)
-
try
_ convert (52) - umask (24)
- union (12)
- unlink (24)
- urandom (8)
- utc (24)
- utime (12)
- warn (9)
-
world
_ readable? (12) -
world
_ writable? (12) - write (24)
- yield (12)
検索結果
先頭5件
- Hash
. ruby2 _ keywords _ hash?(hash) -> bool - RubyVM
. resolve _ feature _ path - RubyVM
:: InstructionSequence . load _ from _ binary(binary) -> RubyVM :: InstructionSequence - RubyVM
:: InstructionSequence . load _ from _ binary _ extra _ data(binary) -> String - RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence
-
Hash
. ruby2 _ keywords _ hash?(hash) -> bool (12294.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
. resolve _ feature _ path (12237.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 . load _ from _ binary(binary) -> RubyVM :: InstructionSequence (12209.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 . load _ from _ binary _ extra _ data(binary) -> String (12109.0) -
バイナリフォーマットの文字列から埋め込まれたextra_dataを取り出します。
...埋め込まれたextra_dataを取り出します。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
binary = iseq.to_binary("extra_data")
RubyVM::InstructionSequence.load_from_binary_extra_data(binary) # => extra_data
//}
@see RubyVM::InstructionSequence#to_binary... -
RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence (9319.0) -
引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
RubyVM::InstructionSequence.compile とは異なり、file、path などの
メタデータは自動的に取得します。
@param file ファ......@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
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::InstructionSequence.compile... -
RubyVM
:: InstructionSequence . of(body) -> RubyVM :: InstructionSequence (9303.0) -
引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。
...指定した Proc、Method オブジェクトを元に
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param body Proc、Method オブジェクトを指定します。
例1:irb で実行した場合
# proc
> p = proc { num = 1 + 2 }
> RubyVM::InstructionSequenc......# => <RubyVM::InstructionSequence: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
de......rld"
end
$a_global_proc = proc { str = 'a' + 'b' }
# irb
> require '/tmp/iseq_of.rb'
# hello メソッド
> RubyVM::InstructionSequence.of(method(:hello))
> # => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>
# グローバル proc
> RubyVM::InstructionSequence.of($a_global_pr... -
RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (9225.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...urce で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定します。
@par......指定します。
@param line 引数 source の 1 行目の行番号を指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
RubyVM::InstructionSequence.compile_o......ption= を参照
してください。
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 (9225.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...urce で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定します。
@par......指定します。
@param line 引数 source の 1 行目の行番号を指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
RubyVM::InstructionSequence.compile_o......ption= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
RubyVM
:: AbstractSyntaxTree . parse(string) -> RubyVM :: AbstractSyntaxTree :: Node (9221.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...aram string パースする対象の Ruby のコードを文字列で指定します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# arg......ます。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定......de#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない......][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 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_toleran... -
RubyVM
:: AbstractSyntaxTree . parse(string , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9221.0) -
文字列を抽象構文木にパースし、その木の根ノードを返します。
...ます。
@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定......de#token が利用できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない......][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 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_toleran... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname) -> RubyVM :: AbstractSyntaxTree :: Node (9215.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...返します。
@param pathname パースする対象のファイルパスを指定します
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。
//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# =>......SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (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)))
//}......返します。
@param pathname パースする対象のファイルパスを指定します
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると......できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして......//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (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)
#... -
RubyVM
:: AbstractSyntaxTree . parse _ file(pathname , keep _ script _ lines: false , error _ tolerant: false , keep _ tokens: false) -> RubyVM :: AbstractSyntaxTree :: Node (9215.0) -
pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。
...返します。
@param pathname パースする対象のファイルパスを指定します
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコードのテキストを取得できます。
@param keep_tokens true を指定すると......できます。
@param error_tolerant true を指定すると、構文エラーが発生した際にエラー箇所を type が :ERROR であるようなノードに置き換えてツリーを生成します。
@raise SyntaxError pathname から取得された文字列が Ruby のコードとして......//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (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)
#... -
Random
. rand(range) -> Integer | Float (9209.0) -
擬似乱数を発生させます。
...ます。
Random::DEFAULT.rand と同じです。
Random#rand を参照してください。
擬似乱数生成器が Kernel.#rand と共通なため Kernel.#srand などの影響を受けます。
@param max 乱数値の上限を正の整数または実数で指定します。
@param range 発......る乱数値の範囲を Range オブジェクトで指定します。
range の境界は数値でなければなりません。
@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに発生します。
@raise ArgumentError 引数の数が0また......を渡した時に発生します。
//emlist[例][ruby]{
srand 1234 # 乱数の種を設定する。
Random.rand(10.0) #=> 1.9151945037889229 (0.0 以上 10.0 未満の実数)
rand(10.0) #=> 6 (rand(10) と同じ)
//}
@see Random.srand, Random#rand, Random::DEFAULT......す。
Random#rand を参照してください。
擬似乱数生成器が Kernel.#rand と共通なため Kernel.#srand などの影響を受けます。
@param max 乱数値の上限を正の整数または実数で指定します。
@param range 発生させる乱数値の範囲を Range オ......ブジェクトで指定します。
range の境界は数値でなければなりません。
@raise Errno::EDOM rand(1..Float::INFINITY) などのように範囲に問題があるときに発生します。
@raise ArgumentError 引数の数が0または1では無い時、引数に負......在しない範囲を渡した時に発生します。
//emlist[例][ruby]{
srand 1234 # 乱数の種を設定する。
Random.rand(10.0) #=> 1.9151945037889229 (0.0 以上 10.0 未満の実数)
rand(10.0) #=> 6 (rand(10) と同じ)
//}
@see Random.srand, Random#rand...