Sha256: 7e7241560117a8f929a4e78bdaebaca4ee8a77d9a60cf63d8e6e22828ac29f32

Contents?: true

Size: 412 Bytes

Versions: 2

Compression:

Stored size: 412 Bytes

Contents

module FlightParse
  # attr_accessor :url, :flights

  def source_url(url = nil)
    @url = url.nil? || url.length == 0 ? HasamiSettings::FLIGHT_URL : url
  end

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hasami-0.1.1 lib/hasami/flight_parse.rb
hasami-0.1.0 lib/hasami/flight_parse.rb