module TimeScales::Frame::PartComponents::HasQuarterOfYear

Attributes

quarter[R]
quarter_of_year[R]

Public Class Methods

included(other) click to toggle source
# File lib/time_scales/frame/part_components.rb, line 217
def self.included(other)
  other.extend HasQuarterOfYear::ClassMixin
end

Private Instance Methods

_initialize(args_array) click to toggle source
Calls superclass method
# File lib/time_scales/frame/part_components.rb, line 227
def _initialize(args_array)
  super
  @quarter_of_year = ensure_fixnum( args_array.shift )
end
prepare_time_struct(struct) click to toggle source
Calls superclass method
# File lib/time_scales/frame/part_components.rb, line 232
def prepare_time_struct(struct)
  to_month =
    (struct.month || 1) +
    3 * (quarter_of_year - 1)
  if to_month > 12
    struct.year = (struct.year || 1) + 1
    to_month -= 12
    struct.month = to_month
  else
    struct.month = to_month
  end
  super
end