Sha256: 2ebb85379447cfe7fa8aa92a0561527bd0b7b307766aacb781b7ad51c5cd286d

Contents?: true

Size: 508 Bytes

Versions: 1

Compression:

Stored size: 508 Bytes

Contents

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

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

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

  def self.job_from_hash hash
    ParcelJob.new(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.2.0 lib/gls_agent.rb