class Moonrope::ActionResult
Attributes
data[RW]
@return [Object] the return value from the action
flags[RW]
@return [Hash] flags which have been set in the action
headers[RW]
@return [Hash] headers which have been set in the action
status[RW]
@return [String] the status of the request
time[RW]
@return [Float] the length of time to process the action
Public Class Methods
new(action)
click to toggle source
Initialize a new result from a Moonrope::Action
.
@param action [Moonrope::Action] the action which originated this result
# File lib/moonrope/action_result.rb, line 9 def initialize(action) @action = action @headers = {} @time = nil @flags = {} end
Public Instance Methods
to_hash()
click to toggle source
Return a Hash representation of this ActionResult
without the headers.
{ :status => 'success', :time => 1.32, :flags => {}, :data => {} }
@return [Hash]
# File lib/moonrope/action_result.rb, line 44 def to_hash { :status => self.status, :time => self.time, :flags => self.flags, :data => self.data } end
to_json()
click to toggle source
Return the ActionResult's hash with a JSON.
@return [String]
# File lib/moonrope/action_result.rb, line 58 def to_json to_hash.to_json end