Sha256: bae4e5d1d5b8116c798a053aaa4641feaef03414d05dfa7a20bdb8d92d0db81e

Contents?: true

Size: 397 Bytes

Versions: 4

Compression:

Stored size: 397 Bytes

Contents

# frozen_string_literal: true
module Arbre

  # 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
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arbre-2.1.0 lib/arbre/element_collection.rb
arbre-2.0.2 lib/arbre/element_collection.rb
arbre-2.0.1 lib/arbre/element_collection.rb
arbre-2.0.0 lib/arbre/element_collection.rb