Module: MWO::Utils
Instance Method Summary collapse
Instance Method Details
#fetch(url) ⇒ Object
2 3 4 5 |
# File 'lib/mwo/utils.rb', line 2 def fetch(url) response = open(url) body = JSON.parse(response.read) end |
#to_symbol(string) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/mwo/utils.rb', line 7 def to_symbol(string) word = string.dup word.gsub!(/::/, '/') word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.tr!('-', '_') word.downcase! word.to_sym end |