Class: Squared::Common::JoinSet

Inherits:
Set
  • Object
show all
Defined in:
lib/squared/common/class.rb

Instance Method Summary collapse

Constructor Details

#initialize(data = [], delim: ' ') ⇒ JoinSet

Returns a new instance of JoinSet.



29
30
31
32
# File 'lib/squared/common/class.rb', line 29

def initialize(data = [], delim: ' ')
  super(data.compact)
  @delim = delim
end

Instance Method Details

#doneObject



34
35
36
37
38
# File 'lib/squared/common/class.rb', line 34

def done
  ret = to_s
  clear
  ret
end

#to_sObject



40
41
42
# File 'lib/squared/common/class.rb', line 40

def to_s
  to_a.map!(&:to_s).reject(&:empty?).join(@delim)
end