Class: Mv::Core::Validation::Custom
- Defined in:
- lib/mv/core/validation/custom.rb
Instance Attribute Summary collapse
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Attributes inherited from Base
#allow_blank, #allow_nil, #as, #column_name, #create_trigger_name, #message, #on, #options, #table_name, #update_trigger_name
Instance Method Summary collapse
-
#initialize(table_name, column_name, opts) ⇒ Custom
constructor
A new instance of Custom.
- #to_a ⇒ Object
Methods inherited from Base
#<=>, #create?, #full_message, #update?
Constructor Details
#initialize(table_name, column_name, opts) ⇒ Custom
Returns a new instance of Custom.
11 12 13 14 15 16 17 |
# File 'lib/mv/core/validation/custom.rb', line 11 def initialize(table_name, column_name, opts) opts = opts.is_a?(Hash) ? opts : { statement: opts } super(table_name, column_name, opts) @statement = opts.with_indifferent_access[:statement] end |
Instance Attribute Details
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
7 8 9 |
# File 'lib/mv/core/validation/custom.rb', line 7 def statement @statement end |
Instance Method Details
#to_a ⇒ Object
19 20 21 |
# File 'lib/mv/core/validation/custom.rb', line 19 def to_a super + [statement.to_s] end |