Class: MeteoPl::Utility::Command
- Inherits:
-
Object
- Object
- MeteoPl::Utility::Command
- Defined in:
- lib/meteo_pl/utility/command.rb
Constant Summary collapse
- PERIODS =
{ short: 60, long: 84 }.freeze
- DEFAULT_PERIOD =
:short
- DEFAULT_TIMEOUT =
2
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(args) ⇒ Command
Returns a new instance of Command.
12 13 14 15 16 17 18 |
# File 'lib/meteo_pl/utility/command.rb', line 12 def initialize(args) @args = args = { timeout: DEFAULT_TIMEOUT, period: PERIODS[DEFAULT_PERIOD] } end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
10 11 12 |
# File 'lib/meteo_pl/utility/command.rb', line 10 def location @location end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/meteo_pl/utility/command.rb', line 10 def end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/meteo_pl/utility/command.rb', line 20 def call parse_input set_location valid? ensure print_help unless valid? end |