Exception: DynamicSchema::RequiredOptionError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path: nil, key:) ⇒ RequiredOptionError

Returns a new instance of RequiredOptionError.



27
28
29
30
31
32
# File 'lib/dynamic_schema/errors.rb', line 27

def initialize( path: nil, key:  )
  path = path ? path.chomp( '/' ) : nil 
  @key = key
  @keypath = path ? ( path + '/' + @key.to_s ) : key.to_s    
  super( "The attribute '#{@keypath}' is required but no value was given." )
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



25
26
27
# File 'lib/dynamic_schema/errors.rb', line 25

def key
  @key
end

#keypathObject (readonly)

Returns the value of attribute keypath.



24
25
26
# File 'lib/dynamic_schema/errors.rb', line 24

def keypath
  @keypath
end