Class: Kitchen::Directions::BakeIndex::V1::IndexSection
- Defined in:
- lib/kitchen/directions/bake_index/v1.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #add_term(term) ⇒ Object
-
#initialize(name:) ⇒ IndexSection
constructor
A new instance of IndexSection.
Constructor Details
#initialize(name:) ⇒ IndexSection
Returns a new instance of IndexSection.
55 56 57 58 59 60 |
# File 'lib/kitchen/directions/bake_index/v1.rb', line 55 def initialize(name:) @force_first = name == I18n.t(:eob_index_symbols_group) @name = name @items = SortedSet.new @items_by_term_text = {} end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
53 54 55 |
# File 'lib/kitchen/directions/bake_index/v1.rb', line 53 def items @items end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
52 53 54 |
# File 'lib/kitchen/directions/bake_index/v1.rb', line 52 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/kitchen/directions/bake_index/v1.rb', line 66 def <=>(other) return -1 if force_first return 1 if other.force_first I18n.sort_strings(name, other.name) end |
#add_term(term) ⇒ Object
62 63 64 |
# File 'lib/kitchen/directions/bake_index/v1.rb', line 62 def add_term(term) item_for(term).add_term(term) end |