Class: Pizzas

Inherits:
Array
  • Object
show all
Defined in:
lib/pizza.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from(source) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/pizza.rb', line 3

def self.from(source)
  doc = Nokogiri::HTML(source)

  Pizzas.new(
    doc.css(".jso-dataLayerProductClick").map { |el| Pizza.new(el) }.select(&:valid?)
  )
end

Instance Method Details

#selection_listObject



11
12
13
# File 'lib/pizza.rb', line 11

def selection_list
  map(&:list_item)
end