Class: CQL::TagFilter
- Inherits:
-
Object
- Object
- CQL::TagFilter
- Defined in:
- lib/cql/filters.rb
Overview
Not a part of the public API. Subject to change at any time.
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Tags to match.
Instance Method Summary collapse
-
#execute(objects, negate) ⇒ Object
Filters the input models so that only the desired ones are returned.
-
#has_tags?(object, target_tags) ⇒ Boolean
Returns whether or not the object has the target tags.
-
#initialize(tags) ⇒ TagFilter
constructor
Creates a new filter.
Constructor Details
#initialize(tags) ⇒ TagFilter
Creates a new filter
10 11 12 |
# File 'lib/cql/filters.rb', line 10 def initialize @tags = end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Tags to match
7 8 9 |
# File 'lib/cql/filters.rb', line 7 def @tags end |
Instance Method Details
#execute(objects, negate) ⇒ Object
Filters the input models so that only the desired ones are returned
24 25 26 27 28 |
# File 'lib/cql/filters.rb', line 24 def execute(objects, negate) method = negate ? :reject : :select objects.send(method) { |object| (object, ) } end |
#has_tags?(object, target_tags) ⇒ Boolean
Returns whether or not the object has the target tags
15 16 17 18 19 20 21 |
# File 'lib/cql/filters.rb', line 15 def (object, ) .all? { |target_tag| = object. = .collect { |tag| tag.name } unless Gem.loaded_specs['cuke_modeler'].version.version[/^0/] .include?(target_tag) } end |