class ResponsiveService::Response
Attributes
context[R]
message[R]
type[R]
valid_states[R]
Public Class Methods
class_valid_states()
click to toggle source
# File lib/responsive_service/response.rb, line 17 def self.class_valid_states @class_valid_states end
new(type, message=nil, context=nil, valid_states=nil)
click to toggle source
# File lib/responsive_service/response.rb, line 5 def initialize(type, message=nil, context=nil, valid_states=nil) @valid_states = Array(valid_states || self.class.class_valid_states) raise "Invalid type of response: #{type}" unless (@valid_states.empty? || @valid_states.include?(type)) @type = type @context = context @message = message end
valid_states(*args)
click to toggle source
# File lib/responsive_service/response.rb, line 13 def self.valid_states(*args) @class_valid_states = Array(args) end
Public Instance Methods
method_missing(method, *args) { || ... }
click to toggle source
Calls superclass method
# File lib/responsive_service/response.rb, line 21 def method_missing(method, *args, &block) if valid_states.empty? || valid_states.include?(method) yield if method == type else super end end