Sha256: 710280ef981dedcdb74e3f77c351455e352b95906d5e95d6f36844a66ed3a9ba

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 Bytes

Contents

module Arbo

  # Stores a collection of Element objects
  class ElementCollection < Array

    def +(other)
      self.class.new(super)
    end

    def -(other)
      self.class.new(super)
    end

    def &(other)
      self.class.new(super)
    end

    def to_s
      self.collect do |element|
        element.to_s
      end.join('').html_safe
    end

    def render_in(context)
      self.collect do |element|
        element.render_in(context)
      end.join('').html_safe
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arbo-1.3.1 lib/arbo/element_collection.rb
arbo-1.3.0 lib/arbo/element_collection.rb
arbo-1.2.0 lib/arbo/element_collection.rb