Module: ActiveRecord::NoTouching
Overview
Active Record No Touching
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.applied_to?(klass) ⇒ Boolean
:nodoc:.
-
.apply_to(klass) ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #no_touching? ⇒ Boolean
-
#touch ⇒ Object
:nodoc:.
-
#touch_later ⇒ Object
:nodoc:.
Class Method Details
.applied_to?(klass) ⇒ Boolean
:nodoc:
36 37 38 |
# File 'lib/active_record/no_touching.rb', line 36 def applied_to?(klass) #:nodoc: klasses.any? { |k| k >= klass } end |
.apply_to(klass) ⇒ Object
:nodoc:
29 30 31 32 33 34 |
# File 'lib/active_record/no_touching.rb', line 29 def apply_to(klass) #:nodoc: klasses.push(klass) yield ensure klasses.pop end |
Instance Method Details
#no_touching? ⇒ Boolean
46 47 48 |
# File 'lib/active_record/no_touching.rb', line 46 def no_touching? NoTouching.applied_to?(self.class) end |
#touch ⇒ Object
:nodoc:
54 55 56 |
# File 'lib/active_record/no_touching.rb', line 54 def touch(*) # :nodoc: super unless no_touching? end |
#touch_later ⇒ Object
:nodoc:
50 51 52 |
# File 'lib/active_record/no_touching.rb', line 50 def touch_later(*) # :nodoc: super unless no_touching? end |