module DailyAffirmation::Affirmations::ClassMethods

Public Instance Methods

affirmations() click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 149
def affirmations
  @affirmations ||= []
end
affirms(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 143
def affirms(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :custom
  }.merge(opts)
end
affirms_absence_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 72
def affirms_absence_of(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :absence
  }.merge(opts)
end
affirms_acceptance_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 78
def affirms_acceptance_of(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :acceptance
  }.merge(opts)
end
affirms_confirmation_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 84
def affirms_confirmation_of(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :confirmation
  }.merge(opts)
end
affirms_equality_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 90
def affirms_equality_of(attribute, opts = {})
  opts[:value] ||= ""
  affirmations << {
    :attribute => attribute, :type => :equality
  }.merge(opts)
end
affirms_exclusion_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 97
def affirms_exclusion_of(attribute, opts = {})
  opts[:list] ||= []
  affirmations << {
    :attribute => attribute, :type => :exclusion
  }.merge(opts)
end
affirms_format_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 104
def affirms_format_of(attribute, opts = {})
  opts[:regex] ||= //
  affirmations << {
    :attribute => attribute, :type => :format
  }.merge(opts)
end
affirms_inclusion_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 111
def affirms_inclusion_of(attribute, opts = {})
  opts[:list] ||= []
  affirmations << {
    :attribute => attribute, :type => :inclusion
  }.merge(opts)
end
affirms_length_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 118
def affirms_length_of(attribute, opts = {})
  opts[:range] ||= 0..0
  affirmations << {
    :attribute => attribute, :type => :length
  }.merge(opts)
end
affirms_numericality_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 125
def affirms_numericality_of(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :numericality
  }.merge(opts)
end
affirms_presence_of(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 131
def affirms_presence_of(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :presence
  }.merge(opts)
end
affirms_valid_date(attribute, opts = {}) click to toggle source
# File lib/daily_affirmation/affirmations.rb, line 137
def affirms_valid_date(attribute, opts = {})
  affirmations << {
    :attribute => attribute, :type => :date
  }.merge(opts)
end