Method: CORL::Mixin::Builder::Global#concatenate

Defined in:
lib/core/mixin/builder.rb

#concatenate(components, capitalize = false, joiner = nil) ⇒ Object




43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/core/mixin/builder.rb', line 43

def concatenate(components, capitalize = false, joiner = nil)
  joiner = resource_joiner unless joiner
  
  if components.is_a?(Array)
    components = components.collect do |str|
      str.to_s.split(id_joiner)  
    end.flatten
  else
    components = [ components.to_s.split(id_joiner) ].flatten
  end
  
  if capitalize
    name = components.collect {|str| str.capitalize }.join(joiner)
  else
    name = components.join(joiner)
  end
  name
end