Module: Graph::Function::ReformatString

Included in:
Comparison
Defined in:
lib/graph/function/reformat_string.rb

Instance Method Summary collapse

Instance Method Details

#camel_title(s) ⇒ Object



7
8
9
# File 'lib/graph/function/reformat_string.rb', line 7

def camel_title(s)
  s.to_s.split('_').collect(&:capitalize).join
end

#escape_underscores(s) ⇒ Object



4
5
6
# File 'lib/graph/function/reformat_string.rb', line 4

def escape_underscores(s)
  s.to_s.gsub("_", "\\_")
end

#extract_filename(s) ⇒ Object



10
11
12
13
# File 'lib/graph/function/reformat_string.rb', line 10

def extract_filename(s)
  matches = /([^\/]+:\d+)\>$/.match(s)
  !matches.nil? ? matches[1] : s
end