Class: GMO::PG::Errors

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/gmo-pg/http_resource/errors.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

SEPARATOR =
'|'

Instance Method Summary collapse

Constructor Details

#initialize(err_code, err_info) ⇒ Errors

Returns a new instance of Errors.



14
15
16
17
# File 'lib/gmo-pg/http_resource/errors.rb', line 14

def initialize(err_code, err_info)
  @err_code = err_code.split(SEPARATOR) unless err_code.nil?
  @err_info = err_info.split(SEPARATOR) unless err_info.nil?
end

Instance Method Details

#eachObject



19
20
21
22
23
24
25
# File 'lib/gmo-pg/http_resource/errors.rb', line 19

def each
  return to_enum unless block_given?
  return nil if @err_code.nil? && @err_info.nil?
  @err_code.zip(@err_info).each do |(err_code, err_info)|
    yield Error.new(err_code, err_info)
  end
end