Class: Troupe::Contract::Property
- Inherits:
-
Object
- Object
- Troupe::Contract::Property
- Defined in:
- lib/troupe/contract/property.rb
Constant Summary collapse
- DEFAULTS =
{ presence: :provided }
- VALID_OPTIONS =
{ presence: [:expected, :permitted, :provided] }
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#on_violation ⇒ Object
Returns the value of attribute on_violation.
-
#presence ⇒ Object
Returns the value of attribute presence.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Property
constructor
A new instance of Property.
- #merge!(hash) ⇒ Object
Constructor Details
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
10 11 12 |
# File 'lib/troupe/contract/property.rb', line 10 def default @default end |
#on_violation ⇒ Object
Returns the value of attribute on_violation.
10 11 12 |
# File 'lib/troupe/contract/property.rb', line 10 def on_violation @on_violation end |
#presence ⇒ Object
Returns the value of attribute presence.
10 11 12 |
# File 'lib/troupe/contract/property.rb', line 10 def presence @presence end |
Instance Method Details
#merge!(hash) ⇒ Object
20 21 22 23 24 |
# File 'lib/troupe/contract/property.rb', line 20 def merge!(hash) hash.each do |k, v| send("#{k}=", v) end end |