種類
- インスタンスメソッド (130)
- 特異メソッド (95)
クラス
- Regexp (33)
-
RubyVM
:: InstructionSequence (192)
キーワード
-
absolute
_ path (11) -
base
_ label (11) -
compile
_ file (11) -
compile
_ option (11) - disasm (11)
- disassemble (11)
- eval (11)
-
first
_ lineno (11) - inspect (11)
- label (11)
-
load
_ from _ binary (9) -
load
_ from _ binary _ extra _ data (9) - new (22)
- of (11)
- path (11)
-
to
_ a (11) -
to
_ binary (9) - ~ (11)
検索結果
先頭5件
- Regexp
. compile(string , option = nil , code = nil) -> Regexp - RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence - RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence - RubyVM
:: InstructionSequence . compile _ option -> Hash - Regexp
. new(string , option = nil , code = nil) -> Regexp
-
Regexp
. compile(string , option = nil , code = nil) -> Regexp (32321.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...m option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指......am code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[......egexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match # =>... -
RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (32321.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 source で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定しま......す。
@param path 引数 file の絶対パスファイル名を文字列で指定します。
@param line 引数 source の 1 行目の行番号を指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指......定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence (20333.0) -
引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...file で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
RubyVM::InstructionSequence.compile とは異なり、file、path などの
メタデータは自動的に取得します。
@param file......rue、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 . compile _ option -> Hash (20315.0) -
命令シーケンスのコンパイル時のデフォルトの最適化オプションを Hash で返 します。
...//emlist[例][ruby]{
require "pp"
pp RubyVM::InstructionSequence.compile_option
# => {:inline_const_cache=>true,
# :peephole_optimization=>true,
# :tailcall_optimization=>false,
# :specialized_instruction=>true,
# :operands_unification=>true,
# :instructions_unification=>false,
# :stack_caching=>fa......lse,
# :trace_instruction=>true,
# :frozen_string_literal=>false,
# :debug_frozen_string_literal=>false,
# :coverage_enabled=>true,
# :debug_level=>0}
//}
@see RubyVM::InstructionSequence.compile_option=... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (17221.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...m option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指......am code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表現のコンパイルに失敗した場合発生します。
//emlist[......egexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"
t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNORECASE)
t2.match(str)
p Regexp.last_match # =>... -
RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (17221.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...引数 source で指定した Ruby のソースコードを元にコンパイル済みの
RubyVM::InstructionSequence オブジェクトを作成して返します。
@param source Ruby のソースコードを文字列で指定します。
@param file ファイル名を文字列で指定しま......す。
@param path 引数 file の絶対パスファイル名を文字列で指定します。
@param line 引数 source の 1 行目の行番号を指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェクトのいずれかで指......定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (14232.0) -
self が表す命令シーケンスの絶対パスを返します。
...elf が表す命令シーケンスの絶対パスを返します。
self を文字列から作成していた場合は nil を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
ise......q.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
@see RubyVM::Ins......tructionSequence#path... -
RubyVM
:: InstructionSequence # base _ label -> String (14232.0) -
self が表す命令シーケンスの基本ラベルを返します。
...self が表す命令シーケンスの基本ラベルを返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.co......le_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"
例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSeq......uence.of(method(:hello)).base_label
# => "hello"
@see RubyVM::InstructionSequence#label... -
RubyVM
:: InstructionSequence # label -> String (14232.0) -
self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。
...self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、
モジュール名などで構成されます。
トップレベルでは "<main>" を返します。self を文字列から作成していた場合
は "<compiled>" を返します。
例1......iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq......= RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.label # => "<main>"
例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).label
# => "hello"
@see RubyVM::InstructionSequence#base_label... -
RubyVM
:: InstructionSequence # disassemble -> String (14214.0) -
self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。
...self が表す命令シーケンスを人間が読める形式の文字列に変換して返します。
puts RubyVM::InstructionSequence.compile('1 + 2').disasm
出力:
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1......( 1)
0002 putobject 1
0004 putobject 2
0006 opt_plus <ic:1>
0008 leave
@see RubyVM::InstructionSequence.disasm...