Class: Redlics::TimeFrame
- Inherits:
-
Object
- Object
- Redlics::TimeFrame
- Defined in:
- lib/redlics/time_frame.rb
Overview
Time Frame class
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Gives read access to the listed instance variables.
-
#granularity ⇒ Object
readonly
Gives read access to the listed instance variables.
-
#to ⇒ Object
readonly
Gives read access to the listed instance variables.
Instance Method Summary collapse
-
#initialize(context, time_object, options = {}) ⇒ Redlics::TimeFrame
constructor
Initialization of a time frame object.
-
#splat ⇒ Array
Construct keys by time frame steps.
Constructor Details
#initialize(context, time_object, options = {}) ⇒ Redlics::TimeFrame
Initialization of a time frame object.
18 19 20 21 22 |
# File 'lib/redlics/time_frame.rb', line 18 def initialize(context, time_object, = {}) raise ArgumentError, 'TimeFrame should be initialized with Symbol, Hash, Range or Time' unless [Symbol, Hash, Range, Time].include?(time_object.class) @from, @to = self.send("init_with_#{time_object.class.name.demodulize.underscore}", time_object, context) @granularity = Granularity.validate(context, [:granularity]).first end |
Instance Attribute Details
#from ⇒ Object (readonly)
Gives read access to the listed instance variables.
7 8 9 |
# File 'lib/redlics/time_frame.rb', line 7 def from @from end |
#granularity ⇒ Object (readonly)
Gives read access to the listed instance variables.
7 8 9 |
# File 'lib/redlics/time_frame.rb', line 7 def granularity @granularity end |
#to ⇒ Object (readonly)
Gives read access to the listed instance variables.
7 8 9 |
# File 'lib/redlics/time_frame.rb', line 7 def to @to end |