Exception: SmartProperties::InitializationError
- Defined in:
- lib/smart_properties/errors.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#sender ⇒ Object
Returns the value of attribute sender.
Instance Method Summary collapse
-
#initialize(sender, properties) ⇒ InitializationError
constructor
A new instance of InitializationError.
- #to_hash ⇒ Object
Constructor Details
#initialize(sender, properties) ⇒ InitializationError
Returns a new instance of InitializationError.
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/smart_properties/errors.rb', line 99 def initialize(sender, properties) @sender = sender @properties = properties super( "%s requires the following properties to be set: %s" % [ sender.class.name, properties.map(&:name).sort.join(', ') ] ) end |
Instance Attribute Details
#properties ⇒ Object
Returns the value of attribute properties.
97 98 99 |
# File 'lib/smart_properties/errors.rb', line 97 def properties @properties end |
#sender ⇒ Object
Returns the value of attribute sender.
96 97 98 |
# File 'lib/smart_properties/errors.rb', line 96 def sender @sender end |
Instance Method Details
#to_hash ⇒ Object
110 111 112 |
# File 'lib/smart_properties/errors.rb', line 110 def to_hash properties.each_with_object({}) { |property, errors| errors[property.name] = "must be set" } end |