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.
108 109 110 111 112 |
# File 'lib/factbase/taped.rb', line 108 def initialize(origin, oid, added) @origin = origin @oid = oid @added = added end |
Instance Method Details
#<<(item) ⇒ Object
131 132 133 134 |
# File 'lib/factbase/taped.rb', line 131 def <<(item) @added.append(@oid) @origin << (item) end |
#[](key) ⇒ Object
119 120 121 |
# File 'lib/factbase/taped.rb', line 119 def [](key) @origin[key] end |
#any? ⇒ Boolean
127 128 129 |
# File 'lib/factbase/taped.rb', line 127 def any?(&) @origin.any?(&) end |
#each ⇒ Object
114 115 116 117 |
# File 'lib/factbase/taped.rb', line 114 def each(&) return to_enum(__method__) unless block_given? @origin.each(&) end |
#to_a ⇒ Object
123 124 125 |
# File 'lib/factbase/taped.rb', line 123 def to_a @origin.to_a end |
#uniq! ⇒ Object
136 137 138 139 |
# File 'lib/factbase/taped.rb', line 136 def uniq! @added.append(@oid) @origin.uniq! end |