Class: Kitchen::Directions::BakeIndex::V1::IndexItem

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/directions/bake_index/v1.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(term_text:) ⇒ IndexItem

Returns a new instance of IndexItem.



29
30
31
32
# File 'lib/kitchen/directions/bake_index/v1.rb', line 29

def initialize(term_text:)
  @term_text = term_text
  @terms = []
end

Instance Attribute Details

#term_textObject (readonly)

Returns the value of attribute term_text.



26
27
28
# File 'lib/kitchen/directions/bake_index/v1.rb', line 26

def term_text
  @term_text
end

#termsObject (readonly)

Returns the value of attribute terms.



27
28
29
# File 'lib/kitchen/directions/bake_index/v1.rb', line 27

def terms
  @terms
end

Instance Method Details

#<=>(other) ⇒ Object



46
47
48
# File 'lib/kitchen/directions/bake_index/v1.rb', line 46

def <=>(other)
  I18n.sort_strings(term_text, other.term_text)
end

#add_term(term) ⇒ Object



34
35
36
# File 'lib/kitchen/directions/bake_index/v1.rb', line 34

def add_term(term)
  @terms.push(term)
end

#capitalize_term_text!Object



42
43
44
# File 'lib/kitchen/directions/bake_index/v1.rb', line 42

def capitalize_term_text!
  @term_text = @term_text.capitalize
end

#uncapitalize_term_text!Object



38
39
40
# File 'lib/kitchen/directions/bake_index/v1.rb', line 38

def uncapitalize_term_text!
  @term_text = @term_text.uncapitalize
end