Sha256: 3bcd0cde081901de7f99772e4462481b2e5f5bd28d8a5652fed892204727d76a

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

require "gls_agent/version"
require 'gls_agent/gls_mech'
require 'gls_agent/dotfile'

module GLSAgent
  ParcelJob = Struct.new(:date, :name, :street, :streetno, :zip, :city, :weight)

  def self.job_from_csv string
    fields = string.split(',')
    if fields.length != 7
      fail 'job_from_csv needs 6 fields'
      return nil
    end
    ParcelJob.new(*fields)
  end

  def self.job_from_hash hash
    ParcelJob.new(hash[:date], hash[:name], hash[:street], hash[:streetno], hash[:zip], hash[:city], hash[:weight])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gls_agent-0.3.0 lib/gls_agent.rb