Class: CqlRuby::FilterReader
- Inherits:
-
Object
- Object
- CqlRuby::FilterReader
- Defined in:
- lib/cql_ruby/filter_reader.rb
Overview
Reads and provides filters.
Accepted filters and syntax:
Type:
type:(,[name])* example: type:def,send
Defined Under Namespace
Classes: HierarchyPattern, NodeSpec
Constant Summary collapse
- NESTING_ALLOWED_TYPES =
%w[class module def block].freeze
Instance Attribute Summary collapse
-
#allowed_types ⇒ Object
readonly
Returns the value of attribute allowed_types.
-
#has_leaves ⇒ Object
readonly
Returns the value of attribute has_leaves.
-
#is_assigned ⇒ Object
Returns the value of attribute is_assigned.
-
#nest_under ⇒ Object
readonly
Returns the value of attribute nest_under.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Instance Method Summary collapse
-
#initialize(raw_filters = []) ⇒ FilterReader
constructor
A new instance of FilterReader.
- #restrict_assignment? ⇒ Boolean
- #restrict_children? ⇒ Boolean
- #restrict_nesting? ⇒ Boolean
- #restrict_pattern? ⇒ Boolean
- #restrict_types? ⇒ Boolean
Constructor Details
#initialize(raw_filters = []) ⇒ FilterReader
Returns a new instance of FilterReader.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cql_ruby/filter_reader.rb', line 73 def initialize(raw_filters = []) super() @allowed_types = [] @nest_under = [] @has_leaves = [] @patterns = [] @is_assigned = false parse_raw_filters(raw_filters) end |
Instance Attribute Details
#allowed_types ⇒ Object (readonly)
Returns the value of attribute allowed_types.
63 64 65 |
# File 'lib/cql_ruby/filter_reader.rb', line 63 def allowed_types @allowed_types end |
#has_leaves ⇒ Object (readonly)
Returns the value of attribute has_leaves.
67 68 69 |
# File 'lib/cql_ruby/filter_reader.rb', line 67 def has_leaves @has_leaves end |
#is_assigned ⇒ Object
Returns the value of attribute is_assigned.
71 72 73 |
# File 'lib/cql_ruby/filter_reader.rb', line 71 def is_assigned @is_assigned end |
#nest_under ⇒ Object (readonly)
Returns the value of attribute nest_under.
65 66 67 |
# File 'lib/cql_ruby/filter_reader.rb', line 65 def nest_under @nest_under end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
69 70 71 |
# File 'lib/cql_ruby/filter_reader.rb', line 69 def patterns @patterns end |
Instance Method Details
#restrict_assignment? ⇒ Boolean
101 102 103 |
# File 'lib/cql_ruby/filter_reader.rb', line 101 def restrict_assignment? @is_assigned end |
#restrict_children? ⇒ Boolean
93 94 95 |
# File 'lib/cql_ruby/filter_reader.rb', line 93 def restrict_children? !@has_leaves.empty? end |
#restrict_nesting? ⇒ Boolean
89 90 91 |
# File 'lib/cql_ruby/filter_reader.rb', line 89 def restrict_nesting? !@nest_under.empty? end |
#restrict_pattern? ⇒ Boolean
97 98 99 |
# File 'lib/cql_ruby/filter_reader.rb', line 97 def restrict_pattern? !@patterns.empty? end |
#restrict_types? ⇒ Boolean
85 86 87 |
# File 'lib/cql_ruby/filter_reader.rb', line 85 def restrict_types? !@allowed_types.empty? end |