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.



71
72
73
74
75
76
77
78
79
# File 'app/helpers/calagator/time_range_helper.rb', line 71

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.



81
82
83
# File 'app/helpers/calagator/time_range_helper.rb', line 81

def context
  @context
end

#partsObject (readonly)

Returns the value of attribute parts.



81
82
83
# File 'app/helpers/calagator/time_range_helper.rb', line 81

def parts
  @parts
end

#timeObject (readonly)

Returns the value of attribute time.



81
82
83
# File 'app/helpers/calagator/time_range_helper.rb', line 81

def time
  @time
end

Instance Method Details

#to_s(format, which) ⇒ Object



83
84
85
# File 'app/helpers/calagator/time_range_helper.rb', line 83

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