Class: Lutaml::Model::InvalidAttributeTypeError

Inherits:
Error
  • Object
show all
Defined in:
lib/lutaml/model/error/invalid_attribute_type_error.rb

Constant Summary collapse

BUILTIN_TYPES =

Built-in types that users commonly reference

%w[
  string integer int float boolean date time datetime
  symbol text hash array any uri decimal double long
  short byte base64binary hexbinary
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(attr_name, type, context = nil) ⇒ InvalidAttributeTypeError

Returns a new instance of InvalidAttributeTypeError.



11
12
13
14
15
16
17
# File 'lib/lutaml/model/error/invalid_attribute_type_error.rb', line 11

def initialize(attr_name, type, context = nil)
  @attr_name = attr_name
  @type = type
  @context = context

  super()
end

Instance Method Details

#to_sObject



19
20
21
22
23
24
25
# File 'lib/lutaml/model/error/invalid_attribute_type_error.rb', line 19

def to_s
  msg = "Invalid type `#{@type.inspect}` for attribute `#{@attr_name}`."
  msg += " #{@context}." if @context
  msg += " #{type_requirement}"
  msg += " #{suggestion}" if suggestion
  msg
end