Sha256: ff10fb081cbde122c18663c1b806a8cd7707e210e61ac5537fb722986a510804

Contents?: true

Size: 535 Bytes

Versions: 6

Compression:

Stored size: 535 Bytes

Contents

module Onebox
  module Helpers
    def self.symbolize_keys(hash)
      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

    def self.clean(html)
      html.gsub(/<[^>]+>/, ' ').gsub(/\n/, '')
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
onebox-1.2.5 lib/onebox/helpers.rb
onebox-1.2.4 lib/onebox/helpers.rb
onebox-1.2.3 lib/onebox/helpers.rb
onebox-1.2.2 lib/onebox/helpers.rb
onebox-1.2.1 lib/onebox/helpers.rb
onebox-1.2.0 lib/onebox/helpers.rb