Class: ObjectAttorney::Validations::Custom
- Inherits:
-
Object
- Object
- ObjectAttorney::Validations::Custom
- Defined in:
- lib/object_attorney/validations/custom.rb
Instance Attribute Summary collapse
-
#attorney ⇒ Object
writeonly
Sets the attribute attorney.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(args) ⇒ Custom
constructor
A new instance of Custom.
- #validate(defendant) ⇒ Object
Constructor Details
#initialize(args) ⇒ Custom
Returns a new instance of Custom.
8 9 10 11 12 |
# File 'lib/object_attorney/validations/custom.rb', line 8 def initialize(args) @methods = args @options = args. end |
Instance Attribute Details
#attorney=(value) ⇒ Object (writeonly)
Sets the attribute attorney
6 7 8 |
# File 'lib/object_attorney/validations/custom.rb', line 6 def attorney=(value) @attorney = value end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/object_attorney/validations/custom.rb', line 4 def @options end |
Instance Method Details
#validate(defendant) ⇒ Object
14 15 16 17 18 |
# File 'lib/object_attorney/validations/custom.rb', line 14 def validate(defendant) [*@methods].all? do |method| Helpers.call_method!(@attorney, method, defendant) end end |