Method: Interval#initialize

Defined in:
lib/mega/interval.rb

#initialize(first, last, exclude_first = false, exclude_last = false) ⇒ Interval

Returns a new instance of Interval.

Raises:

  • (ArgumentError)


77
78
79
80
81
82
83
84
# File 'lib/mega/interval.rb', line 77

def initialize(first, last, exclude_first=false, exclude_last=false )
  raise ArgumentError, "bad value for interval" if first.class != last.class
  @first = first
  @last = last
  @exclude_first = exclude_first
  @exclude_last = exclude_last
  @direction = (@last <=> @first)
end