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.
115 116 117 118 119 |
# File 'lib/factbase/taped.rb', line 115 def initialize(origin, oid, added) @origin = origin @oid = oid @added = added end |
Instance Method Details
#<<(item) ⇒ Object
138 139 140 141 |
# File 'lib/factbase/taped.rb', line 138 def <<(item) @added.append(@oid) @origin << item end |
#[](key) ⇒ Object
126 127 128 |
# File 'lib/factbase/taped.rb', line 126 def [](key) @origin[key] end |
#any? ⇒ Boolean
134 135 136 |
# File 'lib/factbase/taped.rb', line 134 def any?(&) @origin.any?(&) end |
#each ⇒ Object
121 122 123 124 |
# File 'lib/factbase/taped.rb', line 121 def each(&) return to_enum(__method__) unless block_given? @origin.each(&) end |
#to_a ⇒ Object
130 131 132 |
# File 'lib/factbase/taped.rb', line 130 def to_a @origin.to_a end |
#uniq! ⇒ Object
143 144 145 146 |
# File 'lib/factbase/taped.rb', line 143 def uniq! @added.append(@oid) @origin.uniq! end |