Class: Clarc::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/clarc/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, result) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/clarc/response.rb', line 5

def initialize status, result
  @status, @result = status, result
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



9
10
11
12
# File 'lib/clarc/response.rb', line 9

def method_missing name, *args, &block
  return super unless name.end_with?('?')
  @status.to_sym == name[0..-2].to_sym
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



3
4
5
# File 'lib/clarc/response.rb', line 3

def result
  @result
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/clarc/response.rb', line 3

def status
  @status
end