Class: HmxClient::Command::Fountain
- Defined in:
- lib/hmx/command/fountain.rb
Overview
Manipulate hmx fountains (auto id generators)
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#get ⇒ Object
fountain:get.
-
#index ⇒ Object
fountain.
-
#set ⇒ Object
fountain:set .
Methods inherited from Base
#hmx, #initialize, #loadConfig!, namespace, #removeConfig, #storeConfig, #writeConfig
Methods included from Helpers
#display, #display_row, #display_tab, #display_table, #error, #getFromUser, #longest
Constructor Details
This class inherits a constructor from HmxClient::Command::Base
Instance Method Details
#get ⇒ Object
fountain:get
Increments and returns a fountain value
39 40 41 42 43 44 |
# File 'lib/hmx/command/fountain.rb', line 39 def get unless args.size > 0 raise CommandFailed, "Usage: hmx fountain:get <fountainId>" end display hmx.doGetFountain(args) end |
#index ⇒ Object
fountain
Lists all of the fountains and their values
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/hmx/command/fountain.rb', line 13 def index fountainState = hmx.doGetFountainState([]) # fountainState is a map of fountainName => value # Flip this into an array of "name" => name, "value" => value objs = [] fountainState.each_pair do | key, value | objs << { "name" => key, "value" => value } end cols = [ 'name', 'value' ] headers = [ 'Fountain', 'Value' ] display_table(objs, cols, headers) end |
#set ⇒ Object
fountain:set
Sets the new id for the fountain
30 31 32 33 34 35 |
# File 'lib/hmx/command/fountain.rb', line 30 def set unless args.size > 1 raise CommandFailed, "Usage: hmx fountain:set <fountainId> <newValue>" end hmx.doSetFountainId(args) end |