Class: Mv::Core::Validation::BaseCollection
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/mv/core/validation/base_collection.rb
Instance Attribute Summary collapse
-
#in ⇒ Object
readonly
Returns the value of attribute in.
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) ⇒ BaseCollection
constructor
A new instance of BaseCollection.
- #to_a ⇒ Object
Methods inherited from Base
#<=>, #create?, #full_message, #update?
Constructor Details
#initialize(table_name, column_name, opts) ⇒ BaseCollection
Returns a new instance of BaseCollection.
14 15 16 17 18 19 20 |
# File 'lib/mv/core/validation/base_collection.rb', line 14 def initialize(table_name, column_name, opts) opts = opts.is_a?(Hash) ? opts : { in: opts } super(table_name, column_name, opts) @in = opts.with_indifferent_access[:in] end |
Instance Attribute Details
#in ⇒ Object (readonly)
Returns the value of attribute in.
10 11 12 |
# File 'lib/mv/core/validation/base_collection.rb', line 10 def in @in end |
Instance Method Details
#to_a ⇒ Object
22 23 24 25 |
# File 'lib/mv/core/validation/base_collection.rb', line 22 def to_a prepared_in = self.in.is_a?(Range) ? range_to_a : self.in.try(:sort) super + [prepared_in] end |