Module: ValidatesTimeliness::AttributeMethods::ClassMethods

Defined in:
lib/validates_timeliness/attribute_methods.rb

Instance Method Summary collapse

Instance Method Details

#define_timeliness_methods(before_type_cast = false) ⇒ Object



23
24
25
26
27
28
# File 'lib/validates_timeliness/attribute_methods.rb', line 23

def define_timeliness_methods(before_type_cast=false)
  return if timeliness_validated_attributes.blank?
  timeliness_validated_attributes.each do |attr_name|
    define_attribute_timeliness_methods(attr_name, before_type_cast)
  end
end

#generated_timeliness_methodsObject



30
31
32
33
34
# File 'lib/validates_timeliness/attribute_methods.rb', line 30

def generated_timeliness_methods
  @generated_timeliness_methods ||= Module.new { |m| 
    extend Mutex_m
  }.tap { |mod| include mod }
end

#timeliness_attribute_timezone_aware?(attr_name) ⇒ Boolean

Override in ORM shim

Returns:

  • (Boolean)


14
15
16
# File 'lib/validates_timeliness/attribute_methods.rb', line 14

def timeliness_attribute_timezone_aware?(attr_name)
  false
end

#timeliness_attribute_type(attr_name) ⇒ Object

Override in ORM shim



19
20
21
# File 'lib/validates_timeliness/attribute_methods.rb', line 19

def timeliness_attribute_type(attr_name)
  :datetime
end

#undefine_timeliness_attribute_methodsObject



36
37
38
39
40
# File 'lib/validates_timeliness/attribute_methods.rb', line 36

def undefine_timeliness_attribute_methods
  generated_timeliness_methods.module_eval do
    instance_methods.each { |m| undef_method(m) } 
  end
end