Sha256: e06754577426ee4009ab5fced18b336bc1ba7fe3d76b81bea9655a56d1065535

Contents?: true

Size: 398 Bytes

Versions: 3

Compression:

Stored size: 398 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

3 entries across 3 versions & 1 rubygems

Version Path
arbre-1.7.0 lib/arbre/element_collection.rb
arbre-1.6.0 lib/arbre/element_collection.rb
arbre-1.5.0 lib/arbre/element_collection.rb