class Foxy::HtmlResponse

Attributes

html[RW]
params[RW]

Public Class Methods

new(html, params) click to toggle source
# File lib/foxy/html_response.rb, line 5
def initialize(html, params)
  @html = html
  @params = params
end

Public Instance Methods

clean() click to toggle source
# File lib/foxy/html_response.rb, line 14
def clean
  @clean ||= foxy.clean(allow: %w(alt src href title class))
end
foxy() click to toggle source
# File lib/foxy/html_response.rb, line 10
def foxy
  @foxy ||= Foxy::Html.new(@html)
end

Protected Instance Methods

is_list(hash, key, sep = /\s*,\s*/) click to toggle source
# File lib/foxy/html_response.rb, line 24
def is_list(hash, key, sep = /\s*,\s*/)
  return if hash[key].is_a? Array
  hash[key] = hash[key].to_s.split(sep)
end
is_number(hash, key) click to toggle source
# File lib/foxy/html_response.rb, line 20
def is_number(hash, key)
  hash[key] = hash[key].try(:gsub, ",", "").try(:to_i) if hash[key]
end