Class: RedCappedList

Inherits:
Object
  • Object
show all
Defined in:
lib/redness/red_capped_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#capObject

Returns the value of attribute cap.



2
3
4
# File 'lib/redness/red_capped_list.rb', line 2

def cap
  @cap
end

#keyObject

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

#getObject



9
10
11
# File 'lib/redness/red_capped_list.rb', line 9

def get
  RedList.get(key)
end

#get_stringsObject



13
14
15
# File 'lib/redness/red_capped_list.rb', line 13

def get_strings
  RedList.get_strings(key)
end