Sha256: 3c8de552eeeac77994d659f102c6c505fe27bb751fc6e5325a1c477fddbd02a4
Contents?: true
Size: 561 Bytes
Versions: 3
Compression:
Stored size: 561 Bytes
Contents
module Repeatable module Expression class Set < Base def initialize(*elements) @elements = elements.flatten.uniq end def <<(element) elements << element unless elements.include?(element) self end def to_h Hash[hash_key, elements.map(&:to_h)] end def ==(other) other.is_a?(self.class) && elements.size == other.elements.size && other.elements.all? { |e| elements.include?(e) } end protected attr_reader :elements end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
repeatable-0.6.0 | lib/repeatable/expression/set.rb |
repeatable-0.5.0 | lib/repeatable/expression/set.rb |
repeatable-0.4.0 | lib/repeatable/expression/set.rb |