Class: Tenet::MultiPages

Inherits:
Object
  • Object
show all
Defined in:
lib/tenet/multi_pages.rb

Constant Summary collapse

@@urls =
[]
@@attributes =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMultiPages

Returns a new instance of MultiPages.



25
26
27
28
29
30
31
32
# File 'lib/tenet/multi_pages.rb', line 25

def initialize
  @collection = []

  @@urls.each do |url|
    html = Page.new(url).html
    @collection << Row.new(html, @@attributes).to_h
  end
end

Class Method Details

.attribute(name, css:, type: :string) ⇒ Object

Parameters:

  • name (Symbol)
  • css (String)
  • type (Symbol) (defaults to: :string)


20
21
22
# File 'lib/tenet/multi_pages.rb', line 20

def attribute(name, css:, type: :string)
  @@attributes << Attribute.new(name, css: css, type: type)
end

.urls(urls) ⇒ Object

Parameters:

  • urls (Array)


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

def urls(urls)
  @@urls = urls
end

Instance Method Details

#to_aArray<Hash>

Returns:

  • (Array<Hash>)


37
38
39
# File 'lib/tenet/multi_pages.rb', line 37

def to_a
  @collection
end