Class: Puertos::RowParser

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

Overview

The Parser is responsible of fetching the data from Puertos del Estado and return it as ruby objects

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(row) ⇒ RowParser

Returns a new instance of RowParser.



10
11
12
# File 'lib/row_parser.rb', line 10

def initialize row
  @row = row
end

Instance Attribute Details

#rowObject (readonly)

Returns the value of attribute row.



8
9
10
# File 'lib/row_parser.rb', line 8

def row
  @row
end

Instance Method Details

#runForecastData

parses each input line and returns a ForecastData object

Returns:



17
18
19
20
21
22
23
24
25
26
# File 'lib/row_parser.rb', line 17

def run
  timestamp      = create_timestamp
  wind           = create_wind_data
  total_swell    = create_total_swell_data
  wind_swell     = create_wind_swell_data
  ground_swell_1 = create_ground_swell_data_1
  ground_swell_2 = create_ground_swell_data_2

  ForecastData.new timestamp, wind, total_swell, wind_swell, ground_swell_1, ground_swell_2
end