るりまサーチ

最速Rubyリファレンスマニュアル検索!
676件ヒット [1-100件を表示] (0.030秒)

別のキーワード

  1. _builtin last
  2. range last
  3. array last
  4. fiddle last_error
  5. regexp last_match

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Range#last(n) -> [object] (18123.0)

最後の n 要素を返します。範囲内に要素が含まれない場合は空の配列を返します。

...引数を省略して実行した場合は、終端を含むかどうか
(Range#exclude_end? の戻り値)に関わらず終端の要素を返す事に注意し
てください。

//emlist[例][ruby]{
(10..20).last(3) # => [18, 19, 20]
(10...20).last(3) # => [17, 18, 19]
//}

@see Range#first...

Range#end -> object (18118.0)

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。

...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。

//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}

@see Range#begin...

Range#last -> object (18118.0)

終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま せん。

...終端の要素を返します。範囲オブジェクトが終端を含むかどうかは関係ありま
せん。

//emlist[例][ruby]{
(10..20).last # => 20
(10...20).last # => 20
//}

@see Range#begin...

Regexp.last_match(nth) -> String | nil (6179.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 はnil...
...対して、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) # =>...

Regexp.last_match -> MatchData (6144.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
//}...

絞り込み条件を変える

Rake::TaskManager#last_description=(description) (6131.0)

最新の詳細説明をセットします。

...の記載例とする

task default: :test_rake_app1

desc "test1"
task :test_rake_app1 do |task|
task.application.last_description # => "test2"
task.application.last_description = "test3"
task.application.last_description # => "test3"
end


desc "test2"
task :test_rake_app2 do |task|
end

//}...

Kernel$$LAST_MATCH_INFO -> MatchData | nil (6125.0)

$~ の別名

...f=https://www.ruby-lang.org/en/about/license.txt>license</a>"

if /<a href=(.+?)>/ =~ str
p $LAST_MATCH_INFO[0] #=> "<a href=https://www.ruby-lang.org/en/about/license.txt>"
p $LAST_MATCH_INFO[1] #=> "https://www.ruby-lang.org/en/about/license.txt"
p $LAST_MATCH_INFO[2] #=> nil
end
...

Rake::TaskManager#last_comment -> String (6120.0)

Rakefile 内の最新の詳細説明を追跡するためのメソッドです。

...詳細説明を追跡するためのメソッドです。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app1

desc "test1"
task :test_rake_app1 do |task|
p task.application.last_description # => "test2"
end


desc "test2"
task :test_rake_app2 do |task|
end

//}...

Rake::TaskManager#last_description -> String (6120.0)

Rakefile 内の最新の詳細説明を追跡するためのメソッドです。

...詳細説明を追跡するためのメソッドです。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app1

desc "test1"
task :test_rake_app1 do |task|
p task.application.last_description # => "test2"
end


desc "test2"
task :test_rake_app2 do |task|
end

//}...

Kernel$$LAST_PAREN_MATCH -> String | nil (6113.0)

$+ の別名

...r2 = Regexp.compile("<a href=(http|ftp).+?>(.+?)</a>")

while line = DATA.gets
[ r1, r2 ].each {|rep|
rep =~ line
p $+
}
end

__END__
<tr> <td><img src=http://localhost/a.jpg></td> <td>ikkou</td> <td><a href=http://localhost/link.html>link</a></td> </tr>
#enf of sample....

絞り込み条件を変える

<< 1 2 3 ... > >>