Class: SnipSnip::Filter
- Inherits:
-
Object
- Object
- SnipSnip::Filter
- Defined in:
- lib/snip_snip/filter.rb
Overview
Classes to filter out of the tracking when looking at which columns were selected.
Instance Attribute Summary collapse
-
#filtered ⇒ Object
readonly
Returns the value of attribute filtered.
Class Method Summary collapse
Instance Method Summary collapse
- #filtered?(record) ⇒ Boolean
-
#initialize(filtered = []) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(filtered = []) ⇒ Filter
Returns a new instance of Filter.
9 10 11 12 13 14 15 |
# File 'lib/snip_snip/filter.rb', line 9 def initialize(filtered = []) @filtered = filtered return unless ActiveRecord.const_defined?(:InternalMetadata) @filtered << ActiveRecord::InternalMetadata end |
Instance Attribute Details
#filtered ⇒ Object (readonly)
Returns the value of attribute filtered.
7 8 9 |
# File 'lib/snip_snip/filter.rb', line 7 def filtered @filtered end |
Class Method Details
.filtered?(record) ⇒ Boolean
21 22 23 |
# File 'lib/snip_snip/filter.rb', line 21 def self.filtered?(record) (@instance ||= new).filtered?(record) end |
Instance Method Details
#filtered?(record) ⇒ Boolean
17 18 19 |
# File 'lib/snip_snip/filter.rb', line 17 def filtered?(record) filtered.any? { |filter| record.is_a?(filter) } end |