Class: Squared::Common::JoinSet

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of JoinSet.



37
38
39
40
# File 'lib/squared/common/class.rb', line 37

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

Class Method Details

.to_sObject



33
34
35
# File 'lib/squared/common/class.rb', line 33

def self.to_s
  super.match(/[^:]+\z/)[0]
end

Instance Method Details

#doneObject



42
43
44
45
46
# File 'lib/squared/common/class.rb', line 42

def done
  ret = to_s
  clear
  ret
end

#to_sObject



48
49
50
# File 'lib/squared/common/class.rb', line 48

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