Class: String

Inherits:
Object show all
Defined in:
lib/tworgy/standard_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.unique_append(options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tworgy/standard_extensions.rb', line 12

def self.unique_append(options)
  root = options[:root]
  append = options[:append]
  join = options[:join]
  
  if root.blank?
    append
  elsif append.blank? || root.include?(append)
    root
  else
    "#{root}#{join} #{append}"
  end
end

Instance Method Details

#/(str_to_join) ⇒ Object



8
9
10
# File 'lib/tworgy/standard_extensions.rb', line 8

def /(str_to_join) 
  File.join(self, str_to_join) 
end