Class: Factbase::Taped::TapedArray
- Inherits:
-
Object
- Object
- Factbase::Taped::TapedArray
- Defined in:
- lib/factbase/taped.rb
Overview
Decorator of Array.
Instance Method Summary collapse
- #<<(item) ⇒ Object
- #[](key) ⇒ Object
- #any? ⇒ Boolean
- #each ⇒ Object
-
#initialize(origin, oid, added) ⇒ TapedArray
constructor
A new instance of TapedArray.
- #to_a ⇒ Object
- #uniq! ⇒ Object
Constructor Details
#initialize(origin, oid, added) ⇒ TapedArray
Returns a new instance of TapedArray.
99 100 101 102 103 |
# File 'lib/factbase/taped.rb', line 99 def initialize(origin, oid, added) @origin = origin @oid = oid @added = added end |
Instance Method Details
#<<(item) ⇒ Object
122 123 124 125 |
# File 'lib/factbase/taped.rb', line 122 def <<(item) @added.append(@oid) @origin << (item) end |
#[](key) ⇒ Object
110 111 112 |
# File 'lib/factbase/taped.rb', line 110 def [](key) @origin[key] end |
#any? ⇒ Boolean
118 119 120 |
# File 'lib/factbase/taped.rb', line 118 def any?(&) @origin.any?(&) end |
#each ⇒ Object
105 106 107 108 |
# File 'lib/factbase/taped.rb', line 105 def each(&) return to_enum(__method__) unless block_given? @origin.each(&) end |
#to_a ⇒ Object
114 115 116 |
# File 'lib/factbase/taped.rb', line 114 def to_a @origin.to_a end |
#uniq! ⇒ Object
127 128 129 130 |
# File 'lib/factbase/taped.rb', line 127 def uniq! @added.append(@oid) @origin.uniq! end |