Class: Mv::Core::Validation::Custom

Inherits:
Base
  • Object
show all
Defined in:
lib/mv/core/validation/custom.rb

Instance Attribute Summary collapse

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

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

#statementObject (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_aObject



19
20
21
# File 'lib/mv/core/validation/custom.rb', line 19

def to_a
  super + [statement.to_s]
end