Class: Calagator::TimeRangeHelper::TimePart

Inherits:
Object
  • Object
show all
Defined in:
app/helpers/calagator/time_range_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, context, time_only: false, no_meridian: false, from_prefix: false) ⇒ TimePart

Returns a new instance of TimePart.



67
68
69
70
71
72
73
74
75
# File 'app/helpers/calagator/time_range_helper.rb', line 67

def initialize(time, context, time_only: false, no_meridian: false, from_prefix: false)
  @time = time
  @context = context
  @parts = get_parts
  remove_parts_implied_by_context
  remove_day_parts if time_only
  remove_suffix if no_meridian
  set_at_to_from if from_prefix
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



77
78
79
# File 'app/helpers/calagator/time_range_helper.rb', line 77

def context
  @context
end

#partsObject (readonly)

Returns the value of attribute parts.



77
78
79
# File 'app/helpers/calagator/time_range_helper.rb', line 77

def parts
  @parts
end

#timeObject (readonly)

Returns the value of attribute time.



77
78
79
# File 'app/helpers/calagator/time_range_helper.rb', line 77

def time
  @time
end

Instance Method Details

#to_s(format, which) ⇒ Object



79
80
81
# File 'app/helpers/calagator/time_range_helper.rb', line 79

def to_s(format, which)
  TimePartRenderer.new(self, format, which).to_s
end