class Repeatable::Expression::Set
Attributes
elements[R]
Public Class Methods
new(*elements)
click to toggle source
# File lib/repeatable/expression/set.rb, line 6 def initialize(*elements) @elements = elements.flatten.uniq end
Public Instance Methods
<<(element)
click to toggle source
# File lib/repeatable/expression/set.rb, line 10 def <<(element) elements << element unless elements.include?(element) self end
==(other)
click to toggle source
# File lib/repeatable/expression/set.rb, line 19 def ==(other) other.is_a?(self.class) && elements.size == other.elements.size && other.elements.all? { |e| elements.include?(e) } end
to_h()
click to toggle source
# File lib/repeatable/expression/set.rb, line 15 def to_h Hash[hash_key, elements.map(&:to_h)] end