Exception: Pione::Lang::MethodInterfaceError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/pione/lang/pione-method.rb

Overview

MethodInterfaceError is a exception for method interface mismatching.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(kind, name, types, values) ⇒ MethodInterfaceError

Returns a new instance of MethodInterfaceError.

Parameters:

  • kind (Symbol)

    :input or :output

  • name (String)

    method name

  • types (Array<Type>)

    expected types

  • values (Array<BasicModel>)

    values



18
19
20
21
22
23
# File 'lib/pione/lang/pione-method.rb', line 18

def initialize(kind, name, types, values)
  @kind = kind
  @name = name
  @types = types
  @values = values
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



5
6
7
# File 'lib/pione/lang/pione-method.rb', line 5

def kind
  @kind
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/pione/lang/pione-method.rb', line 6

def name
  @name
end

#typesObject (readonly)

Returns the value of attribute types.



7
8
9
# File 'lib/pione/lang/pione-method.rb', line 7

def types
  @types
end

#valuesObject (readonly)

Returns the value of attribute values.



8
9
10
# File 'lib/pione/lang/pione-method.rb', line 8

def values
  @values
end

Instance Method Details

#messageObject



25
26
27
28
29
# File 'lib/pione/lang/pione-method.rb', line 25

def message
  types = @types.map{|type| type}.join(" -> ")
  values = @values.map{|value| value.inspect}.join(" -> ")
  '"%s" expected %s but got %s' % [@name, types, values]
end