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
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.
-
#nest_under ⇒ Object
readonly
Returns the value of attribute nest_under.
Instance Method Summary collapse
-
#initialize(raw_filters) ⇒ FilterReader
constructor
A new instance of FilterReader.
- #restrict_children? ⇒ Boolean
- #restrict_nesting? ⇒ Boolean
- #restrict_types? ⇒ Boolean
Constructor Details
#initialize(raw_filters) ⇒ FilterReader
Returns a new instance of FilterReader.
51 52 53 54 55 56 57 58 59 |
# File 'lib/cql_ruby/filter_reader.rb', line 51 def initialize(raw_filters) super() @allowed_types = [] @nest_under = [] @has_leaves = [] parse_raw_filters(raw_filters) end |
Instance Attribute Details
#allowed_types ⇒ Object (readonly)
Returns the value of attribute allowed_types.
45 46 47 |
# File 'lib/cql_ruby/filter_reader.rb', line 45 def allowed_types @allowed_types end |
#has_leaves ⇒ Object (readonly)
Returns the value of attribute has_leaves.
49 50 51 |
# File 'lib/cql_ruby/filter_reader.rb', line 49 def has_leaves @has_leaves end |
#nest_under ⇒ Object (readonly)
Returns the value of attribute nest_under.
47 48 49 |
# File 'lib/cql_ruby/filter_reader.rb', line 47 def nest_under @nest_under end |
Instance Method Details
#restrict_children? ⇒ Boolean
69 70 71 |
# File 'lib/cql_ruby/filter_reader.rb', line 69 def restrict_children? !@has_leaves.empty? end |
#restrict_nesting? ⇒ Boolean
65 66 67 |
# File 'lib/cql_ruby/filter_reader.rb', line 65 def restrict_nesting? !@nest_under.empty? end |
#restrict_types? ⇒ Boolean
61 62 63 |
# File 'lib/cql_ruby/filter_reader.rb', line 61 def restrict_types? !@allowed_types.empty? end |