Sha256: 96558cef3444964802bb66a0c48e9e778c0b68b62e2674585316328f3c91e775

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

require "fsr/app"
module FSR
  module App
    class ValetPark < Application
      attr_reader :valet_lot, :stall_number, :action, :range, :timeout, :prompt

      def initialize(valet_lot, args = {})
        @valet_lot = valet_lot
        @stall_number, @action, @range, @timeout, @prompt = args.values_at(:stall_number, :action, :range, :timeout, :prompt)
        case action
          when nil
            raise "Usage: <valet_info> <stall_number>" unless @valet_lot && @stall_number
          when :ask
            raise "Usage: <valet_lot> <range> <timeout> <prompt>" unless @valet_lot && @range && @timeout && @prompt
            @range = "#{@range.min} #{@range.max}"          
          when :auto
            raise "Usage: <valet_lot> <range>" unless @valet_lot && @range
            @range = "#{@range.min} #{@range.max}" 
            @action = "auto in" 
          else
            raise "Action must be nil, ask or auto" 
        end
      end

      def arguments
        [valet_lot, stall_number, action, range, timeout, prompt].compact
      end

      def app_name
        'valet_park'
      end
    end

    register(:valet_park, ValetPark)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
freeswitcher-0.8.0 lib/fsr/app/valet_park.rb
freeswitcher-0.7.1 lib/fsr/app/valet_park.rb
freeswitcher-0.7.0 lib/fsr/app/valet_park.rb
freeswitcher-0.6.18 lib/fsr/app/valet_park.rb
freeswitcher-0.6.17 lib/fsr/app/valet_park.rb
freeswitcher-0.6.16 lib/fsr/app/valet_park.rb
freeswitcher-0.6.15 lib/fsr/app/valet_park.rb
freeswitcher-0.6.14 lib/fsr/app/valet_park.rb
freeswitcher-0.6.13 lib/fsr/app/valet_park.rb
freeswitcher-0.6.12 lib/fsr/app/valet_park.rb
freeswitcher-0.6.11 lib/fsr/app/valet_park.rb
freeswitcher-0.6.10 lib/fsr/app/valet_park.rb
freeswitcher-0.6.9 lib/fsr/app/valet_park.rb
freeswitcher-0.6.8 lib/fsr/app/valet_park.rb
freeswitcher-0.6.7 lib/fsr/app/valet_park.rb
freeswitcher-0.6.6 lib/fsr/app/valet_park.rb