Class: Runtime
Constant Summary collapse
- @@spec =
{ "login" => :login, "auth" => :auth, "quit" => :exit, "exit" => :exit, "get_classes" => :get_classes }
Instance Method Summary collapse
-
#initialize(action) ⇒ Runtime
constructor
A new instance of Runtime.
Methods included from Runners
Constructor Details
#initialize(action) ⇒ Runtime
Returns a new instance of Runtime.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/magister_cli/runtime.rb', line 44 def initialize(action) if action["options"] != nil @opts = action["options"] else @opts = {"outputMode" => "formatted"} end if @opts["noCache"] != nil && @opts["noCache"] == "true" $magister_useCache = false else $magister_useCache = true end requiredArgs = Parser.new("").get_args(action["action"]) args = Array.new if action["parameters"] == nil raise "Not a single parameter defined!! not even an empty array!" end requiredArgs.each do |arg| action["parameters"].each do |param| if arg == param["key"] args.append(param["value"]) end end end send(@@spec[action["action"]], *args) end |