Class: ActiveFacts::CQL::Compiler::ExpressionTermList
- Inherits:
-
Object
- Object
- ActiveFacts::CQL::Compiler::ExpressionTermList
- Defined in:
- lib/activefacts/cql/compiler/transform_rule.rb
Instance Attribute Summary collapse
-
#term_list ⇒ Object
Returns the value of attribute term_list.
Instance Method Summary collapse
- #compile(context) ⇒ Object
-
#initialize(term_list) ⇒ ExpressionTermList
constructor
A new instance of ExpressionTermList.
Constructor Details
#initialize(term_list) ⇒ ExpressionTermList
Returns a new instance of ExpressionTermList.
108 109 110 |
# File 'lib/activefacts/cql/compiler/transform_rule.rb', line 108 def initialize term_list @term_list = term_list end |
Instance Attribute Details
#term_list ⇒ Object
Returns the value of attribute term_list.
106 107 108 |
# File 'lib/activefacts/cql/compiler/transform_rule.rb', line 106 def term_list @term_list end |
Instance Method Details
#compile(context) ⇒ Object
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/activefacts/cql/compiler/transform_rule.rb', line 112 def compile(context) vocabulary_identifier = context.vocabulary. constellation = context.vocabulary.constellation expression = context.vocabulary.constellation.Expression(:new, :expression_type => 'Role') @term_list.flatten! (0 ... @term_list.size).each do |idx| ref = term_list[idx] if (object_type = constellation.ObjectType[[vocabulary_identifier, ref.term]]).nil? raise "Object '#{ref.term}' of transformation must be a valid object type" end constellation.ExpressionObjectRef( expression, idx, :object_type => object_type, :leading_adjective => ref.leading_adjective, :trailing_adjective => ref.trailing_adjective ) end expression end |