Module: Lyricli::Util

Included in:
LyricsEngine, SourceManager
Defined in:
lib/lyricli/util.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) camelize(str)



3
4
5
# File 'lib/lyricli/util.rb', line 3

def camelize(str)
  str.split('_').map {|w| w.capitalize}.join
end

- (Object) parse_class(class_name)



7
8
9
10
11
12
13
14
# File 'lib/lyricli/util.rb', line 7

def parse_class(class_name)
  begin
    path = "Sources::#{class_name}"
    return eval(path)
  rescue NameError
    return nil
  end
end

- (Object) sanitize_param(p)



16
17
18
# File 'lib/lyricli/util.rb', line 16

def sanitize_param(p)
  URI.encode_www_form_component(p.gsub(/ /, "+")).gsub("%2B", "+")
end