| Class | Informix::IntervalBase |
| In: |
lib/informix/interval.rb
|
| Parent: | Object |
The IntervalBase class is used for sending and retrieving INTERVAL values to/from Informix.
It can be used in some expressions with Numeric, Date, DateTime and Time.
| val | [R] |
IntervalBase.new(val) => interval
Creates an Interval object with val as value.
# File lib/informix/interval.rb, line 44
44: def initialize(val)
45: return @val = val if Numeric === val
46: raise TypeError, "Expected Numeric"
47: end
Adds an Interval object to a Numeric or another compatible Interval
interval + numeric => interval interval + interval => interval
# File lib/informix/interval.rb, line 56
56: def +(obj)
57: case obj
58: when Numeric
59: self.class.new(@val + obj)
60: when self.class
61: self.class.new(@val + obj.val)
62: else
63: raise TypeError, "#{self.class} cannot be added to #{obj.class}"
64: end
65: end