Class: Timestamper::Configuration
- Inherits:
-
Object
- Object
- Timestamper::Configuration
- Defined in:
- lib/timestamper/configuration.rb
Instance Attribute Summary collapse
-
#updated_at_column ⇒ Object
Returns the value of attribute updated_at_column.
Instance Method Summary collapse
- #exclude(*args) ⇒ Object
- #excluded_models ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #only(*args) ⇒ Object
- #only_models ⇒ Object
- #reportable?(klass) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 |
# File 'lib/timestamper/configuration.rb', line 5 def initialize @updated_at_column = :updated_at @exclude = [] @only = [] end |
Instance Attribute Details
#updated_at_column ⇒ Object
Returns the value of attribute updated_at_column.
3 4 5 |
# File 'lib/timestamper/configuration.rb', line 3 def updated_at_column @updated_at_column end |
Instance Method Details
#exclude(*args) ⇒ Object
11 12 13 |
# File 'lib/timestamper/configuration.rb', line 11 def exclude(*args) @exclude += args end |
#excluded_models ⇒ Object
15 16 17 |
# File 'lib/timestamper/configuration.rb', line 15 def excluded_models @exclude.dup end |
#only(*args) ⇒ Object
19 20 21 |
# File 'lib/timestamper/configuration.rb', line 19 def only(*args) @only += args end |
#only_models ⇒ Object
23 24 25 |
# File 'lib/timestamper/configuration.rb', line 23 def only_models @only.dup end |
#reportable?(klass) ⇒ Boolean
27 28 29 30 31 32 33 34 35 |
# File 'lib/timestamper/configuration.rb', line 27 def reportable?(klass) return true if @exclude.empty? and @only.empty? if @only.empty? !@exclude.include?(klass) else (@only - @exclude).include?(klass) end end |