Class: PR::Pin::API::Result

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/pr/pin/api/result.rb

Direct Known Subclasses

PaginatedResult

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result, relation) ⇒ Result

Returns a new instance of Result.



14
15
16
17
# File 'lib/pr/pin/api/result.rb', line 14

def initialize(result, relation)
  @__relation__ = relation
  super(result)
end

Class Method Details

.wrap(relation, &block) ⇒ Object



8
9
10
11
12
# File 'lib/pr/pin/api/result.rb', line 8

def self.wrap(relation, &block)
  new(block.call, relation)
rescue PR::Pin::Adapter::ResponseError => error
  relation.dataset.error_handler.(Error.new(error))
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/pr/pin/api/result.rb', line 23

def error?
  false
end

#inspectObject



27
28
29
# File 'lib/pr/pin/api/result.rb', line 27

def inspect
  "#<#{self.class} - #{__getobj__}>"
end

#success?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/pr/pin/api/result.rb', line 19

def success?
  true
end