module FlightParse
Public Instance Methods
flights_parse()
click to toggle source
# File lib/alohaha/flight_parse.rb, line 8 def flights_parse @flights = [] ic = Iconv.new('UTF-8', 'BIG5') row_data = ic.iconv(Curl.get(@url).body_str) row_data.each_line do |line| @flights << FlightHaha.new(line.split(',').map {|al| al = al.strip}) end end
source_url(url = nil)
click to toggle source
attr_accessor :url, :flights
# File lib/alohaha/flight_parse.rb, line 4 def source_url(url = nil) @url = url.nil? || url.length == 0 ? Settings::FLIGHT_URL : url end