Module: ParanoidStarlight::Attributes::Validations

Defined in:
lib/paranoid_starlight/attributes/validations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/paranoid_starlight/attributes/validations.rb', line 4

def self.included(base)
  base.send(:extend, self)
end

Instance Method Details

#validates_email_format_of(*attr_names) ⇒ Object



8
9
10
11
12
# File 'lib/paranoid_starlight/attributes/validations.rb', line 8

def validates_email_format_of(*attr_names)
  # _merge_attributes extracts options and flatten attrs
  # :attributes => {attr_names} is lightweight option
  validates_with ::ParanoidStarlight::Validators::EmailValidator, _merge_attributes(attr_names)
end

#validates_name_format_of(*attr_names) ⇒ Object



14
15
16
# File 'lib/paranoid_starlight/attributes/validations.rb', line 14

def validates_name_format_of(*attr_names)
  validates_with ::ParanoidStarlight::Validators::NameValidator, _merge_attributes(attr_names)
end

#validates_telephone_number_convertibility_of(*attr_names) ⇒ Object



18
19
20
# File 'lib/paranoid_starlight/attributes/validations.rb', line 18

def validates_telephone_number_convertibility_of(*attr_names)
  validates_with ::ParanoidStarlight::Validators::TelephoneValidator, _merge_attributes(attr_names)
end

#validates_telephone_number_of(*attr_names) ⇒ Object

will be deprecated or reworked



23
24
25
# File 'lib/paranoid_starlight/attributes/validations.rb', line 23

def validates_telephone_number_of(*attr_names)
  validates_with ::ParanoidStarlight::Validators::TelephoneValidator, _merge_attributes(attr_names)
end