4件ヒット
[1-4件を表示]
(0.053秒)
種類
- インスタンスメソッド (2)
- 特異メソッド (2)
クラス
- Regexp (3)
-
RubyVM
:: InstructionSequence (1)
キーワード
-
first
_ lineno (1) - new (1)
- ~ (1)
検索結果
先頭4件
-
Regexp
. compile(string , option = nil , code = nil) -> Regexp (54382.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
第一引数が正規表現であれば第一引数を複製して返します。第二、第三引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, fals... -
Regexp
. new(string , option = nil , code = nil) -> Regexp (9082.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
第一引数が正規表現であれば第一引数を複製して返します。第二、第三引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, fals... -
Regexp
# ~ -> Integer | nil (328.0) -
変数 $_ の値との間でのマッチをとります。
変数 $_ の値との間でのマッチをとります。
ちょうど以下と同じ意味です。
//emlist[][ruby]{
self =~ $_
//}
//emlist[例][ruby]{
$_ = "hogehoge"
if /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition
reg = Regexp.compile("foo")
if ~ reg
puts "match"
else
puts "no matc... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (328.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
self が表す命令シーケンスの 1 行目の行番号を返します。
例1:irb で実行した場合
RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
例2:
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2