Module: Uniqueable::ClassMethods
- Defined in:
- lib/uniqueable.rb
Instance Attribute Summary collapse
-
#uniqueable_checks ⇒ Object
Returns the value of attribute uniqueable_checks.
Instance Method Summary collapse
Instance Attribute Details
#uniqueable_checks ⇒ Object
Returns the value of attribute uniqueable_checks.
17 18 19 |
# File 'lib/uniqueable.rb', line 17 def uniqueable_checks @uniqueable_checks end |
Instance Method Details
#uniqueable(*values) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/uniqueable.rb', line 18 def uniqueable(*values) = values.last.kind_of?(Hash) ? values.pop : {} group = .delete(:group) klass = self uniqueable_checks[group] ||= {} uniqueable_checks[group][klass] ||= [] values.each do |value| unless .empty? value = {value => } end uniqueable_checks[group][klass] << value end uniqueable_checks[group][klass].uniq! end |