Class: Zona::JSONPool

Inherits:
JSONElement show all
Defined in:
zona/OZonesJSON.rb

Overview

This class represents a collection of JSON Elements and it is itself one

Direct Known Subclasses

OZonesPool

Instance Method Summary (collapse)

Methods inherited from JSONElement

#[], #initialize_json

Constructor Details

- (JSONPool) initialize(json_hash = nil)

Initializes an instance

Parameters:

  • json_hash (Hash) (defaults to: nil)

    a hash with the object description



104
105
106
# File 'zona/OZonesJSON.rb', line 104

def initialize(json_hash=nil)
    super(json_hash)
end

Instance Method Details

- (Object) each_element(block)

Allows to iterate through the elements of a JSONPool

Parameters:

  • block (Block)

    a block to be called in each iteration



110
111
112
113
114
# File 'zona/OZonesJSON.rb', line 110

def each_element(block)
    @json_hash[@element_name].each do |elem|
        block.call self.factory(elem)
    end
end