Class: ResultIO
- Inherits:
-
Object
- Object
- ResultIO
- Defined in:
- app/models/result_io.rb
Instance Attribute Summary collapse
-
#appInfoIO ⇒ Object
Returns the value of attribute appInfoIO.
-
#cart_commands ⇒ Object
Returns the value of attribute cart_commands.
-
#cart_properties ⇒ Object
Returns the value of attribute cart_properties.
-
#data ⇒ Object
Returns the value of attribute data.
-
#debugIO ⇒ Object
Returns the value of attribute debugIO.
-
#errorIO ⇒ Object
Returns the value of attribute errorIO.
-
#exitcode ⇒ Object
Returns the value of attribute exitcode.
-
#hasUserActionableError ⇒ Object
Returns the value of attribute hasUserActionableError.
-
#messageIO ⇒ Object
Returns the value of attribute messageIO.
-
#resultIO ⇒ Object
Returns the value of attribute resultIO.
Instance Method Summary collapse
- #append(resultIO) ⇒ Object
-
#initialize ⇒ ResultIO
constructor
A new instance of ResultIO.
- #to_json(*args) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ ResultIO
Returns a new instance of ResultIO.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/result_io.rb', line 4 def initialize @debugIO = StringIO.new @resultIO = StringIO.new @messageIO = StringIO.new @errorIO = StringIO.new @appInfoIO = StringIO.new @data = "" @exitcode = 0 @cart_commands = [] @cart_properties = {} @hasUserActionableError = false end |
Instance Attribute Details
#appInfoIO ⇒ Object
Returns the value of attribute appInfoIO.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def appInfoIO @appInfoIO end |
#cart_commands ⇒ Object
Returns the value of attribute cart_commands.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def cart_commands @cart_commands end |
#cart_properties ⇒ Object
Returns the value of attribute cart_properties.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def cart_properties @cart_properties end |
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def data @data end |
#debugIO ⇒ Object
Returns the value of attribute debugIO.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def debugIO @debugIO end |
#errorIO ⇒ Object
Returns the value of attribute errorIO.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def errorIO @errorIO end |
#exitcode ⇒ Object
Returns the value of attribute exitcode.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def exitcode @exitcode end |
#hasUserActionableError ⇒ Object
Returns the value of attribute hasUserActionableError.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def hasUserActionableError @hasUserActionableError end |
#messageIO ⇒ Object
Returns the value of attribute messageIO.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def @messageIO end |
#resultIO ⇒ Object
Returns the value of attribute resultIO.
2 3 4 |
# File 'app/models/result_io.rb', line 2 def resultIO @resultIO end |
Instance Method Details
#append(resultIO) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/models/result_io.rb', line 17 def append(resultIO) self.debugIO << resultIO.debugIO.string self.resultIO << resultIO.resultIO.string self. << resultIO..string self.errorIO << resultIO.errorIO.string self.appInfoIO << resultIO.appInfoIO.string self.cart_commands += resultIO.cart_commands self.cart_properties = resultIO.cart_properties.merge(self.cart_properties) self.exitcode = resultIO.exitcode self.data += resultIO.data if resultIO.exitcode != 0 if resultIO.hasUserActionableError unless (!self.hasUserActionableError) && self.exitcode != 0 self.hasUserActionableError = true end else self.hasUserActionableError = false end end self end |
#to_json(*args) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'app/models/result_io.rb', line 54 def to_json(*args) reply = LegacyReply.new reply.debug = @debugIO.string reply. = @messageIO.string if !@errorIO.string.empty? reply.result = @errorIO.string else reply.result = @resultIO.string end reply.data = @data reply.exit_code = @exitcode reply.to_json(*args) end |
#to_s ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'app/models/result_io.rb', line 41 def to_s str = "--DEBUG--\n#{@debugIO.string}\n" + "--RESULT--\n#{@resultIO.string}\n" + "--MESSAGE--\n#{@messageIO.string}\n" + "--ERROR--\n#{@errorIO.string}\n" + "--APP INFO--\n#{@appInfoIO.string}\n" + "--CART COMMANDS--\n#{@cart_commands.join("\n")}\n" + "--CART PROPERTIES--\n#{@cart_properties.inspect}\n" + "--DATA--\n#{@data}\n" + "--EXIT CODE--\n#{@exitcode}\n" + "--USER ACTIONABLE--\n#{@hasUserActionableError}\n" end |