Sha256: 2c54dbfd1917ec2fc9fc5805e55b3580241c9ca17bac1b7b407fd7ab892f2b24

Contents?: true

Size: 537 Bytes

Versions: 3

Compression:

Stored size: 537 Bytes

Contents

module Dozuki
  class NodeCollection
    attr_accessor :collection

    def initialize(collection)
      self.collection = collection
    end

    def as_node(&blk)
      collection.each{|item| blk.call(Node.new(item))}
    end

    def as_string(&blk)
      collection.each{|item| blk.call(Parsers::String.parse(item))}
    end

    def as_int(&blk)
      collection.each{|item| blk.call(Parsers::Integer.parse(item))}
    end

    def as_float(&blk)
      collection.each{|item| blk.call(Parsers::Float.parse(item))}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dozuki-0.2.0 lib/dozuki/node_collection.rb
dozuki-0.1.0 lib/dozuki/node_collection.rb
dozuki-0.0.3 lib/dozuki/node_collection.rb