class TimeSeq
Constants
- Attrs
- VERSION
Public Class Methods
new(opt={})
click to toggle source
# File lib/time_seq.rb, line 10 def new(opt={}) init(nil).tap do |time_seq| time_seq.instance_eval do extract opt build_enum end end end
Also aliased as: init
Public Instance Methods
inspect()
click to toggle source
# File lib/time_seq.rb, line 27 def inspect "#<#{self.class}:#{object_id} #{inspect_attrs}>" end
Private Instance Methods
build_enum()
click to toggle source
# File lib/time_seq.rb, line 39 def build_enum @e = Enumerator.new do |yielder| time_point = from loop do yielder << time_point time_point = step.since time_point break if to and time_point > to end end.lazy __setobj__ @e end
extract(opt={})
click to toggle source
# File lib/time_seq.rb, line 33 def extract(opt={}) Attrs.each do |attr| send(attr + '=', opt[attr] || opt[attr.to_sym]) end end
inspect_attrs()
click to toggle source
# File lib/time_seq.rb, line 51 def inspect_attrs Attrs.map do |attr| value = send attr value ? "@#{attr}=#{value.inspect}" : nil end.compact.join ', ' end