Exception: PG::URL::Error::InvalidType

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pg/url/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invalid = [], message = String.new) ⇒ InvalidType

Returns a new instance of InvalidType.


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/pg/url/error.rb', line 25

def initialize(invalid = [], message = String.new)
  @invalid = invalid
  message = message.empty? ? 'Invalid parameter type(s)' : message
  message.build! do |s|
    lines = []
    invalid.each do |param|
      line = String.build "\n" do |s2|
        s2 << "#{param[:param]}: "
        s2 << "Got #{param[:is_a?]}, "
        s2 << "Expected [#{param[:expected]*', '}]"
      end
      lines << line
    end
    s << lines*', '
  end
  super(message)
end

Instance Attribute Details

#invalidObject (readonly)

Returns the value of attribute invalid


24
25
26
# File 'lib/pg/url/error.rb', line 24

def invalid
  @invalid
end