Module: Onebox::Helpers
- Defined in:
- lib/onebox/helpers.rb
Class Method Summary collapse
Class Method Details
.clean(html) ⇒ Object
20 21 22 |
# File 'lib/onebox/helpers.rb', line 20 def self.clean(html) html.gsub(/<[^>]+>/, ' ').gsub(/\n/, '') end |
.symbolize_keys(hash) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/onebox/helpers.rb', line 3 def self.symbolize_keys(hash) return {} if hash.nil? hash.inject({}){|result, (key, value)| new_key = case key when String then key.to_sym else key end new_value = case value when Hash then symbolize_keys(value) else value end result[new_key] = new_value result } end |