Class: Assumption::DataImporter

Inherits:
Object
  • Object
show all
Includes:
UniFunctions
Defined in:
lib/assumption/data_importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UniFunctions

#clear_terminal, #get_char, #title, #underline

Constructor Details

#initialize(year) ⇒ DataImporter

Returns a new instance of DataImporter.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/assumption/data_importer.rb', line 8

def initialize (year)
  
begin
  html = open("http://www.uk-charts.top-source.info/top-100-#{year}.shtml")
rescue OpenURI::HTTPError => error
  response = error.io
  clear_terminal
  puts "Source error, please contact gem creator"
  puts response.status
  puts "Press any key to exit"
  get_char
  exit
end 

doc = Nokogiri::HTML(html)
@output = transform(doc)

end

Instance Attribute Details

#input=(value) ⇒ Object (writeonly)

Sets the attribute input

Parameters:

  • value

    the value to set the attribute input to.



6
7
8
# File 'lib/assumption/data_importer.rb', line 6

def input=(value)
  @input = value
end

#outputObject (readonly)

Returns the value of attribute output.



5
6
7
# File 'lib/assumption/data_importer.rb', line 5

def output
  @output
end