Sha256: 05c0d752ec5249bcb8842ce7518e6ed31a068daa305f66322378038fce9066e0
Contents?: true
Size: 611 Bytes
Versions: 2
Compression:
Stored size: 611 Bytes
Contents
module Legato class ListParameter attr_reader :name, :elements def initialize(name, elements=[]) @name = name @elements = Array.wrap(elements) end def name @name.to_s end def <<(element) (@elements += Array.wrap(element)).compact! self end def to_params value = elements.map{|element| Legato.to_ga_string(element)}.join(',') value.empty? ? {} : {name => value} end def ==(other) name == other.name && elements == other.elements end def include?(element) @elements.include?(element) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
legato-0.3.0 | lib/legato/list_parameter.rb |
legato-0.2.0 | lib/legato/list_parameter.rb |