Exception: SmartProperties::InvalidValueError

Inherits:
AssignmentError show all
Defined in:
lib/smart_properties/errors.rb

Instance Attribute Summary collapse

Attributes inherited from AssignmentError

#property, #sender

Instance Method Summary collapse

Constructor Details

#initialize(sender, property, value) ⇒ InvalidValueError

Returns a new instance of InvalidValueError.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/smart_properties/errors.rb', line 65

def initialize(sender, property, value)
  @value = value

  super(
    sender,
    property,
    "%s does not accept %s as value for the property %s. Only accepts: %s" % [
      sender.class.name,
      value.inspect,
      property.name,
      accepter_message(sender, property)
    ]
  )
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



63
64
65
# File 'lib/smart_properties/errors.rb', line 63

def value
  @value
end

Instance Method Details

#to_hashObject



80
81
82
# File 'lib/smart_properties/errors.rb', line 80

def to_hash
  Hash[property.name, "does not accept %s as value" % value.inspect]
end