Sha256: 74dd0f75a25982f24d03796c42bc4d9ffd7d51dc819bfbe52b9d125a73e22c3e

Contents?: true

Size: 565 Bytes

Versions: 28

Compression:

Stored size: 565 Bytes

Contents

module Onebox
  module Helpers
    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

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

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
onebox-1.3.3 lib/onebox/helpers.rb
onebox-1.3.2 lib/onebox/helpers.rb
onebox-1.3.1 lib/onebox/helpers.rb
onebox-1.3.0 lib/onebox/helpers.rb
onebox-1.2.9 lib/onebox/helpers.rb
onebox-1.2.8 lib/onebox/helpers.rb
onebox-1.2.7 lib/onebox/helpers.rb
onebox-1.2.6 lib/onebox/helpers.rb