Class: Assumption::DataImporter
- Inherits:
-
Object
- Object
- Assumption::DataImporter
- Includes:
- UniFunctions
- Defined in:
- lib/assumption/data_importer.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
writeonly
Sets the attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(year) ⇒ DataImporter
constructor
A new instance of DataImporter.
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
6 7 8 |
# File 'lib/assumption/data_importer.rb', line 6 def input=(value) @input = value end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/assumption/data_importer.rb', line 5 def output @output end |