Class: FSR::App::ValetPark
- Inherits:
-
Application
- Object
- Application
- FSR::App::ValetPark
- Defined in:
- lib/fsr/app/valet_park.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#stall_number ⇒ Object
readonly
Returns the value of attribute stall_number.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#valet_lot ⇒ Object
readonly
Returns the value of attribute valet_lot.
Instance Method Summary collapse
- #app_name ⇒ Object
- #arguments ⇒ Object
-
#initialize(valet_lot, args = {}) ⇒ ValetPark
constructor
A new instance of ValetPark.
Methods inherited from Application
Constructor Details
#initialize(valet_lot, args = {}) ⇒ ValetPark
Returns a new instance of ValetPark.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fsr/app/valet_park.rb', line 7 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 |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def action @action end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def prompt @prompt end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def range @range end |
#stall_number ⇒ Object (readonly)
Returns the value of attribute stall_number.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def stall_number @stall_number end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def timeout @timeout end |
#valet_lot ⇒ Object (readonly)
Returns the value of attribute valet_lot.
5 6 7 |
# File 'lib/fsr/app/valet_park.rb', line 5 def valet_lot @valet_lot end |
Instance Method Details
#app_name ⇒ Object
29 30 31 |
# File 'lib/fsr/app/valet_park.rb', line 29 def app_name 'valet_park' end |
#arguments ⇒ Object
25 26 27 |
# File 'lib/fsr/app/valet_park.rb', line 25 def arguments [valet_lot, stall_number, action, range, timeout, prompt].compact end |