るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.022秒)
トップページ > クラス:Range[x] > クエリ:first[x] > クエリ:new[x]

別のキーワード

  1. _builtin first
  2. array first
  3. range first
  4. matrix first_minor
  5. enumerable first

ライブラリ

検索結果

Range.new(first, last, exclude_end = false) -> Range (18297.0)

first から last までの範囲オブジェクトを生成して返しま す。

...
first
から last までの範囲オブジェクトを生成して返しま
す。

exclude_end が真ならば終端を含まない範囲オブジェクトを生
成します。exclude_end 省略時には終端を含みます。

@param first 最初のオブジェクト
@param last 最後のオブ...
...r first <=> last が nil の場合に発生します

//emlist[例: 整数の範囲オブジェクトの場合][ruby]{
Range
.new(1, 10) # => 1..10
Range
.new(1, 10, true) # => 1...10
//}

//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range
.new...
...[ruby]{
require 'ipaddr'
Range
.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.1
# 192.0.2.2
# 192.0.2.3
//}

//emlist[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end

de...