Class: ValidatesSubset::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/arguments.rb

Overview

Wrapper class for arguments consumed by validates_with

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, superset, options) ⇒ Arguments

Returns a new instance of Arguments.



10
11
12
13
14
# File 'lib/arguments.rb', line 10

def initialize(attribute_name, superset, options)
  @attribute_name = attribute_name
  @superset       = superset
  @options        = options.is_a?(Hash) ? options : {}
end

Instance Method Details

#to_validation_attributesObject

format expected by _merge_attributes

return: <Array> - cardinality of 2



20
21
22
# File 'lib/arguments.rb', line 20

def to_validation_attributes
  [@attribute_name, merged_options]
end