Class: BottleRocket::TimeUnitBuilder
- Inherits:
-
Object
- Object
- BottleRocket::TimeUnitBuilder
- Includes:
- ContentTags
- Defined in:
- lib/bottle_rocket/tag_builders/time_unit_builder.rb
Instance Attribute Summary collapse
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(unit, value) ⇒ TimeUnitBuilder
constructor
A new instance of TimeUnitBuilder.
- #one? ⇒ Boolean
- #to_html ⇒ Object
Constructor Details
#initialize(unit, value) ⇒ TimeUnitBuilder
Returns a new instance of TimeUnitBuilder.
7 8 9 10 |
# File 'lib/bottle_rocket/tag_builders/time_unit_builder.rb', line 7 def initialize(unit, value) @unit = unit @value = value end |
Instance Attribute Details
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
5 6 7 |
# File 'lib/bottle_rocket/tag_builders/time_unit_builder.rb', line 5 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/bottle_rocket/tag_builders/time_unit_builder.rb', line 5 def value @value end |
Instance Method Details
#one? ⇒ Boolean
12 13 14 |
# File 'lib/bottle_rocket/tag_builders/time_unit_builder.rb', line 12 def one? [-1, 1].include? value end |
#to_html ⇒ Object
16 17 18 19 20 |
# File 'lib/bottle_rocket/tag_builders/time_unit_builder.rb', line 16 def to_html ContentTag.new(:span, class: "#{unit}-#{value}").to_s do value.to_s end end |