Class: Joyent::Cloud::Pricing::Scraper::Parser

Inherits:
Struct
  • Object
show all
Defined in:
lib/pricing/scraper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#docObject

Returns the value of attribute doc

Returns:

  • (Object)

    the current value of doc



14
15
16
# File 'lib/pricing/scraper.rb', line 14

def doc
  @doc
end

Instance Method Details

#resultObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/pricing/scraper.rb', line 16

def result
  config = Hash.new
  self.doc.css('ul.full-specs').each do |ul|
    flavor = extract_price(ul)
    next if flavor.cost.nil?
    next if flavor.name =~ /kvm/ && flavor.os !~ /linux/i
    config[flavor.name]= flavor.to_h
  end
  config
end