Class: RedCappedList
- Inherits:
-
Object
- Object
- RedCappedList
- Defined in:
- lib/redness/red_capped_list.rb
Instance Attribute Summary collapse
-
#cap ⇒ Object
Returns the value of attribute cap.
-
#key ⇒ Object
Returns the value of attribute key.
Instance Method Summary collapse
- #add(value) ⇒ Object
- #get ⇒ Object
- #get_strings ⇒ Object
-
#initialize(key, cap) ⇒ RedCappedList
constructor
A new instance of RedCappedList.
Constructor Details
#initialize(key, cap) ⇒ RedCappedList
Returns a new instance of RedCappedList.
4 5 6 7 |
# File 'lib/redness/red_capped_list.rb', line 4 def initialize(key, cap) self.key = key self.cap = cap end |
Instance Attribute Details
#cap ⇒ Object
Returns the value of attribute cap.
2 3 4 |
# File 'lib/redness/red_capped_list.rb', line 2 def cap @cap end |
#key ⇒ Object
Returns the value of attribute key.
2 3 4 |
# File 'lib/redness/red_capped_list.rb', line 2 def key @key end |
Instance Method Details
#add(value) ⇒ Object
17 18 19 20 |
# File 'lib/redness/red_capped_list.rb', line 17 def add(value) RedList.add(key, value) RedList.trim_to(key, cap) end |
#get ⇒ Object
9 10 11 |
# File 'lib/redness/red_capped_list.rb', line 9 def get RedList.get(key) end |
#get_strings ⇒ Object
13 14 15 |
# File 'lib/redness/red_capped_list.rb', line 13 def get_strings RedList.get_strings(key) end |