別のキーワード
種類
- インスタンスメソッド (376)
- 変数 (172)
- 特異メソッド (100)
- 定数 (11)
- クラス (11)
クラス
- Array (44)
-
Encoding
:: Converter (44) -
Enumerator
:: Lazy (22) - Exception (7)
- Object (11)
- Range (33)
- Regexp (55)
-
RubyVM
:: AbstractSyntaxTree :: Node (12) - String (154)
- Thread (32)
モジュール
- Enumerable (66)
- Kernel (172)
- Process (7)
キーワード
-
$ & (11) -
$ & # 39; (11) -
$ 1 (11) -
$ 10 (11) -
$ 11 (11) -
$ 2 (11) -
$ 3 (11) -
$ 4 (11) -
$ 5 (11) -
$ 6 (11) -
$ 7 (11) -
$ 8 (11) -
$ 9 (11) -
$ ? (7) -
$ ` (11) -
$ ~ (11) - =~ (11)
- Regexp (11)
-
SCRIPT
_ LINES _ _ (11) - [] (66)
- begin (11)
-
chunk
_ while (11) - compile (11)
- first (44)
-
last
_ column (6) -
last
_ error (11) -
last
_ lineno (6) -
last
_ match (22) -
last
_ status (7) - new (44)
-
report
_ on _ exception (16) -
report
_ on _ exception= (16) - slice (66)
- slice! (22)
-
slice
_ after (22) -
slice
_ before (22) -
slice
_ when (11) - zip (22)
検索結果
先頭5件
-
Array
# last(n) -> Array (18168.0) -
末尾の n 要素を配列で返します。n は 0 以上でなければなりません。
...上でなければなりません。
@param n 取得したい要素の個数を整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙......指定した場合に発生します。
@raise ArgumentError n が負値の場合発生します。
//emlist[例][ruby]{
ary = [0, 1, 2]
p ary.last(0)
p ary.last(1)
p ary.last(2)
p ary.last(3)
p ary.last(4)
# => []
# [2]
# [1, 2]
# [0, 1, 2]
# [0, 1, 2]
//}
@see Array#first... -
Array
# last -> object | nil (18138.0) -
配列の末尾の要素を返します。配列が空のときは nil を返します。
...配列の末尾の要素を返します。配列が空のときは nil を返します。
//emlist[例][ruby]{
p [0, 1, 2].last #=> 2
p [].last #=> nil
//}
@see Array#first... -
Regexp
. last _ match(nth) -> String | nil (9228.0) -
整数 nth が 0 の場合、マッチした文字列を返します ($&)。それ以外では、nth 番目の括弧にマッチ した部分文字列を返します($1,$2,...)。 対応する括弧がない場合やマッチしなかった場合には nil を返し ます。
...(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match(0) # => "ab"
p Regexp.last_match(1) # => "a"
p Regexp.last_match(2) # => "b"
p Regexp.last_match(3) # => nil
//}
正規表現全体がマッチしなかった場合、引数なしの
Regexp.last_match はn......、
last_match[1] の形式では例外 NoMethodError が発生します。
対して、last_match(1) は nil を返します。
//emlist[例][ruby]{
str = "This is Regexp"
/That is Regexp/ =~ str
p Regexp.last_match # => nil
begin
p Regexp.last_match[1] # 例外が発生する
rescue
puts $!......# => undefined method `[]' for nil:NilClass
end
p Regexp.last_match(1) # => nil
//}
@param nth 整数を指定します。
整数 nth が 0 の場合、マッチした文字列を返します。それ以外では、nth 番目の括弧にマッチした部分文字列を返します。... -
Process
. last _ status -> Process :: Status | nil (9215.0) -
カレントスレッドで最後に終了した子プロセスのステータスを返します。
...じです。
Process.wait Process.spawn("ruby", "-e", "exit 13")
Process.last_status # => #<Process::Status: pid 4825 exit 13>
カレントスレッドで子プロセスを実行したことがない場合は nil を返します。
Process.last_status # => nil
@see Process::Status
@... -
Regexp
. last _ match -> MatchData (9183.0) -
カレントスコープで最後に行った正規表現マッチの MatchData オ ブジェクトを返します。このメソッドの呼び出しは $~ の参照と同じです。
...のメソッドの呼び出しは $~
の参照と同じです。
//emlist[例][ruby]{
/(.)(.)/ =~ "ab"
p Regexp.last_match # => #<MatchData:0x4599e58>
p Regexp.last_match[0] # => "ab"
p Regexp.last_match[1] # => "a"
p Regexp.last_match[2] # => "b"
p Regexp.last_match[3] # => nil
//}... -
Encoding
:: Converter # last _ error -> Exception | nil (6239.0) -
直前に変換器で発生した例外に相当する例外オブジェクトを返します。 直前の変換で例外が発生していない場合は nil を返します。
...", "iso-8859-1")
p ec.primitive_convert(src="\xf1abcd", dst="") #=> :invalid_byte_sequence
p ec.last_error #=> #<Encoding::InvalidByteSequenceError: "\xF1" followed by "a" on UTF-8>
p ec.primitive_convert(src, dst, nil, 1) #=> :destination_buffer_full
p ec.last_error #=>... -
Regexp
. compile(string , option = nil , code = nil) -> Regexp (6126.0) -
文字列 string をコンパイルして正規表現オブジェクトを生成して返します。
...して返します。第二、第三引数は警告の上無視されます。
@param string 正規表現を文字列として与えます。
@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer......Regexp::IGNORECASE の指定と同じになります。
@param code "n", "N" が与えられた時には、生成された正規表現のエンコーディングは ASCII-8BIT になります。
それ以外の指定は警告を出力します。
@raise RegexpError 正規表......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... -
RubyVM
:: AbstractSyntaxTree :: Node # last _ column -> Integer (6115.0) -
ソースコード中で、self を表すテキストが最後に現れる列番号を返します。
...ソースコード中で、self を表すテキストが最後に現れる列番号を返します。
列番号は0-originで、バイト単位で表されます。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
p node.last_column # => 5
//}... -
RubyVM
:: AbstractSyntaxTree :: Node # last _ lineno -> Integer (6115.0) -
ソースコード中で、self を表すテキストが最後に現れる行番号を返します。
...ソースコード中で、self を表すテキストが最後に現れる行番号を返します。
行番号は1-originです。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
p node.last_lineno # => 1
//}... -
Enumerator
:: Lazy # zip(*lists) -> Enumerator :: Lazy (6108.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #......<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip... -
Enumerator
:: Lazy # zip(*lists) {|v1 , v2 , . . . | . . . } -> nil (6108.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #......<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>
1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip...