Exception: SafeType::EmptyValueError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/safe_type/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(desired_type, key = nil) ⇒ EmptyValueError

Returns a new instance of EmptyValueError.



38
39
40
41
42
43
44
# File 'lib/safe_type/errors.rb', line 38

def initialize(desired_type, key=nil)
  super("Expected a " + (key.nil? ? '' : "key (#{key}) with ")  +
        "value of desired type (#{desired_type}), but received a nil value")

  @key = key
  @desired_type = desired_type
end

Instance Attribute Details

#desired_typeObject (readonly)

Returns the value of attribute desired_type.



36
37
38
# File 'lib/safe_type/errors.rb', line 36

def desired_type
  @desired_type
end

#keyObject (readonly)

Returns the value of attribute key.



35
36
37
# File 'lib/safe_type/errors.rb', line 35

def key
  @key
end