種類
- 特異メソッド (66)
- 文書 (53)
- インスタンスメソッド (11)
ライブラリ
- ビルトイン (77)
クラス
- Regexp (33)
-
RubyVM
:: InstructionSequence (44)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
compile
_ file (11) -
compile
_ option= (11) - new (22)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) - ~ (11)
- 正規表現 (11)
検索結果
先頭5件
- RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence - Regexp
. compile(string , option = nil , code = nil) -> Regexp - RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence - RubyVM
:: InstructionSequence . compile _ option=(options) - RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence
-
RubyVM
:: InstructionSequence . compile(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (18431.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>......@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (18335.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指定と同じになります。
@param code "n", "N" が与えられた時には、......に失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
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 # => "This is Regexp"
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)[0] # => "ふるいけや\nかわずと"
//}... -
RubyVM
:: InstructionSequence . compile _ file(file , options = nil) -> RubyVM :: InstructionSequence (6232.0) -
引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...す。
RubyVM::InstructionSequence.compile とは異なり、file、path などの
メタデータは自動的に取得します。
@param file ファイル名を文字列で指定します。
@param options コンパイル時のオプションを true、false、Hash オブ
ジェ......yVM::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=(options) (6155.0) -
命令シーケンスのコンパイル時のデフォルトの最適化オプションを引数 options で指定します。
...ションを true、false、nil、
Hash のいずれかで指定します。true を指定した場合は
全てのオプションを有効にします。false を指定した場合は全
てのオプションを無効にします。nil を指定した場......のオプションも変更しません。また、Hash を指定した
場合は以下のキーに対して、true か false を指定する事で個
別に有効、無効を指定します。
//emlist{
* :inline_const_cache
* :instructions_unification......、.compile、.compile_file メソッドの実行の際に option 引数を指定し
た場合はその実行のみ最適化オプションを変更する事もできます。
@see RubyVM::InstructionSequence.new,
RubyVM::InstructionSequence.compile,
RubyVM::InstructionSequence.compile_fi... -
RubyVM
:: InstructionSequence . new(source , file = nil , path = nil , line = 1 , options = nil) -> RubyVM :: InstructionSequence (3331.0) -
引数 source で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。
...、false、Hash オブ
ジェクトのいずれかで指定します。詳細は
RubyVM::InstructionSequence.compile_option= を参照
してください。
RubyVM::InstructionSequence.compile("a = 1 + 2")
# => <RubyVM::InstructionSequence:<compiled>......@<compiled>>
@see RubyVM::InstructionSequence.compile_file... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (3235.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORECASE の指定と同じになります。
@param code "n", "N" が与えられた時には、......に失敗した場合発生します。
//emlist[例][ruby]{
str = "This is Regexp"
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 # => "This is Regexp"
str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)[0] # => "ふるいけや\nかわずと"
//}... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (468.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)
追加された -W オプションは $VERBOSE = nil の指定(-W0)を......from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]
=> ruby 1.8.0 (2003-06-21) [i586-linux]
[1, 2, nil]
Proc.new { break }.call
=> ruby 1.6.8 (2002-12-24) [i586-linux]
=> -:1:in `call': break from proc-c......ンパイルせず文字列そのものをパターンとして扱うようになりました。(よ
り正確には、Regexp.compile(arg) でなく
Regexp.compile(Regexp.quote(arg)) するようになりました)
((<String#~|String/~>)), ((<String#=~|String/=~>)) は、obsolete にな... -
ruby 1
. 6 feature (360.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...new("foo") == Hash.new("bar")
=> ruby 1.6.7 (2002-03-01) [i586-linux]
true
=> ruby 1.6.7 (2002-08-21) [i586-linux]
false
# : 2002-08-01 IO#read, gets ..., etc.
#
# File::NONBLOCK を指定した IO の読み込みで EWOULDBLOCK が発生すると、
#...... nil
を返すようになりました。(String#[]やString#slice と同じ結果を返すと
いうことです)
p "foo".slice!("bar") # <- 以前からこちらは nil を返していた
p "foo".slice!(5,10)
=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil......#{..} の中などで不完全な部分がありました。
((<ruby-list:34478>))
#! ruby -Ks
p a = "#{"表"}"
=> -:1: compile error in string expansion (SyntaxError)
-:1: unterminated string meets end of file
ruby 1.6.7 (2002-03-15) [i586-linux]... -
正規表現 (144.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...#<MatchData "y">
/[a-z[0-9]]/.match("[") # => nil
r = /[a-w&&[^c-g]e]/ # ([a-w] かつ ([^c-g] もしくは e)) つまり [abeh-w] と同じ
r.match("b") # => #<MatchData "b">
r.match("c") # => nil
r.match("e") # => #<MatchData "e">
r.match("g") # => nil
r.match("h") # => #<MatchData "h">
r.match("......ker" a:"rekxker" b:"k">
//}
以下の例では、開始タグと終了タグを対応付ける正規表現です。
//emlist[][ruby]{
r = Regexp.compile(<<'__REGEXP__'.strip, Regexp::EXTENDED)
(?<element> \g<stag> \g<content>* \g<etag> ){0}
(?<stag> < \g<name> \s* > ){0}
(?<name> [a-zA-Z_:]+ ){0}......くは (?(cond)truepat|falsepat) という
記法で条件分岐を記述できます。
(?(cond)pat) は cond が真の場合は部分式 pat が使われます。
(?(cond)truepat|falsepat) は cond が真の場合は部分式 truepat が使われ、
偽の場合には falsepat が使われます... -
Regexp
# ~ -> Integer | nil (119.0) -
変数 $_ の値との間でのマッチをとります。
...> no match
# ただし、警告がでる。warning: regex literal in condition
reg = Regexp.compile("foo")
if ~ reg
puts "match"
else
puts "no match"
end
# => no match
if reg
puts "match"
else
puts "no match"
end
# => match
# reg は nil でも false でも無いので常にtrue
//}...