Class: BlockArray
- Inherits:
-
Object
- Object
- BlockArray
- Defined in:
- lib/active_document/database.rb
Overview
This allows us to support a block in find without changing the syntax.
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #<<(item) ⇒ Object
-
#initialize(block) ⇒ BlockArray
constructor
A new instance of BlockArray.
Constructor Details
#initialize(block) ⇒ BlockArray
Returns a new instance of BlockArray.
170 171 172 173 |
# File 'lib/active_document/database.rb', line 170 def initialize(block) @block = block @size = 0 end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
174 175 176 |
# File 'lib/active_document/database.rb', line 174 def size @size end |
Instance Method Details
#<<(item) ⇒ Object
176 177 178 179 |
# File 'lib/active_document/database.rb', line 176 def <<(item) @size += 1 @block.call(item) end |