Class: Secure::Response

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, value) ⇒ Response

Returns a new instance of Response.



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

def initialize(error, value)
  @error = error
  @value = value
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Class Method Details

.error(error) ⇒ Object



19
20
21
# File 'lib/secure/response.rb', line 19

def error(error)
  Response.new(error, nil)
end

.success(value) ⇒ Object



15
16
17
# File 'lib/secure/response.rb', line 15

def success(value)
  Response.new(nil, value)
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


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

def success?
  error.nil?
end