Class: TableSync::InterfaceError

Inherits:
Error
  • Object
show all
Defined in:
lib/table_sync/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(object, method_name, parameters, description) ⇒ InterfaceError

Returns a new instance of InterfaceError.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/table_sync/errors.rb', line 59

def initialize(object, method_name, parameters, description)
  parameters = parameters.map do |parameter|
    type, name = parameter

    case type
    when :req
      # :nocov:
      name.to_s
      # :nocov:
    when :keyreq
      "#{name}:"
    when :block
      "&#{name}"
    end
  end

  signature = "#{method_name}(#{parameters.join(", ")})"

  super("#{object} has to implement method `#{signature}`\n#{description}")
end