Class: SDC::SpecialContainer
- Inherits:
-
Object
- Object
- SDC::SpecialContainer
- Defined in:
- lib/core/SpecialContainer.rb
Instance Method Summary collapse
- #add(element, index = nil) ⇒ Object
- #get(index) ⇒ Object
- #get_all ⇒ Object
-
#initialize ⇒ SpecialContainer
constructor
A new instance of SpecialContainer.
- #size ⇒ Object
Constructor Details
#initialize ⇒ SpecialContainer
Returns a new instance of SpecialContainer.
10 11 12 |
# File 'lib/core/SpecialContainer.rb', line 10 def initialize @values = [] end |
Instance Method Details
#add(element, index = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/core/SpecialContainer.rb', line 14 def add(element, index = nil) if index then @values[index] = element else @values.push(element) end return @values.size end |
#get(index) ⇒ Object
28 29 30 |
# File 'lib/core/SpecialContainer.rb', line 28 def get(index) return @values[index] end |
#get_all ⇒ Object
24 25 26 |
# File 'lib/core/SpecialContainer.rb', line 24 def get_all return @values end |
#size ⇒ Object
32 33 34 |
# File 'lib/core/SpecialContainer.rb', line 32 def size return @values.size end |