Class: CqlRuby::FilterReader::HierarchyPattern
- Inherits:
-
Object
- Object
- CqlRuby::FilterReader::HierarchyPattern
- Defined in:
- lib/cql_ruby/filter_reader.rb
Constant Summary collapse
- SELF_MARKER =
'X'
Instance Attribute Summary collapse
-
#ancestors ⇒ Object
readonly
Returns the value of attribute ancestors.
-
#descendants ⇒ Object
readonly
Returns the value of attribute descendants.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ancestors, descendants) ⇒ HierarchyPattern
constructor
A new instance of HierarchyPattern.
Constructor Details
#initialize(ancestors, descendants) ⇒ HierarchyPattern
Returns a new instance of HierarchyPattern.
32 33 34 35 |
# File 'lib/cql_ruby/filter_reader.rb', line 32 def initialize(ancestors, descendants) @ancestors = ancestors @descendants = descendants end |
Instance Attribute Details
#ancestors ⇒ Object (readonly)
Returns the value of attribute ancestors.
29 30 31 |
# File 'lib/cql_ruby/filter_reader.rb', line 29 def ancestors @ancestors end |
#descendants ⇒ Object (readonly)
Returns the value of attribute descendants.
30 31 32 |
# File 'lib/cql_ruby/filter_reader.rb', line 30 def descendants @descendants end |
Class Method Details
.from(raw_value) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cql_ruby/filter_reader.rb', line 18 def self.from(raw_value) parts = raw_value.split('-') self_marker_idx = parts.index(SELF_MARKER) raise "Missing self marker '#{SELF_MARKER}' in hierarchy pattern." if self_marker_idx.nil? ancestors = parts[0...self_marker_idx] descendants = parts[self_marker_idx + 1..] new(ancestors, descendants) end |