Module: RBoss::Cli::ResultParser
- Included in:
- Invoker
- Defined in:
- lib/rboss/cli/result_parser.rb
Defined Under Namespace
Classes: Type
Constant Summary collapse
- STRING =
Type::new 'STRING' do |string| "\"#{string}\"" end
- BOOLEAN =
Type::new 'BOOLEAN' do |string| 'true' == string.downcase end
- INT =
Type::new 'INT' do |string| string.to_i end
- LONG =
Type::new 'LONG' do |string| string.to_i end
- LIST =
Type::new 'LIST'
- OBJECT =
Type::new 'OBJECT'
Instance Method Summary collapse
Instance Method Details
#eval_result(result) ⇒ Object
70 71 72 73 74 75 76 77 |
# File 'lib/rboss/cli/result_parser.rb', line 70 def eval_result(result) undefined = nil #prevents error because undefined means nil in result object result = result.gsub(/(\d+)L/, '\1') #removes the long type mark result = result.gsub(/expression\s/, '') #removes the expression indicator result = eval(result) raise InvocationFailed::new(result["failure-description"]) if result["outcome"] == "failed" result["result"] end |