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