Class: ActiveFacts::CQL::Compiler::Literal
- Inherits:
-
Object
- Object
- ActiveFacts::CQL::Compiler::Literal
- Defined in:
- lib/activefacts/cql/compiler/expression.rb
Instance Attribute Summary collapse
-
#clause ⇒ Object
Returns the value of attribute clause.
-
#leading_adjective ⇒ Object
readonly
Returns the value of attribute leading_adjective.
-
#literal ⇒ Object
Returns the value of attribute literal.
-
#objectification_of ⇒ Object
readonly
Returns the value of attribute objectification_of.
-
#role ⇒ Object
Returns the value of attribute role.
-
#role_ref ⇒ Object
Returns the value of attribute role_ref.
-
#trailing_adjective ⇒ Object
readonly
Returns the value of attribute trailing_adjective.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#value_constraint ⇒ Object
readonly
Returns the value of attribute value_constraint.
Instance Method Summary collapse
- #bind(context) ⇒ Object
- #binding ⇒ Object
- #identify_other_players(context) ⇒ Object
- #identify_player(context) ⇒ Object
- #identify_players_with_role_name(context) ⇒ Object
-
#initialize(literal, unit) ⇒ Literal
constructor
A new instance of Literal.
- #inspect ⇒ Object
- #nested_clauses ⇒ Object
- #player ⇒ Object
-
#role_name ⇒ Object
Stubs:.
- #to_s ⇒ Object
Constructor Details
#initialize(literal, unit) ⇒ Literal
Returns a new instance of Literal.
392 393 394 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 392 def initialize literal, unit @literal, @unit = literal, unit end |
Instance Attribute Details
#clause ⇒ Object
Returns the value of attribute clause.
389 390 391 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 389 def clause @clause end |
#leading_adjective ⇒ Object (readonly)
Returns the value of attribute leading_adjective.
390 391 392 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 390 def leading_adjective @leading_adjective end |
#literal ⇒ Object
Returns the value of attribute literal.
389 390 391 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 389 def literal @literal end |
#objectification_of ⇒ Object (readonly)
Returns the value of attribute objectification_of.
390 391 392 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 390 def objectification_of @objectification_of end |
#role ⇒ Object
Returns the value of attribute role.
389 390 391 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 389 def role @role end |
#role_ref ⇒ Object
Returns the value of attribute role_ref.
389 390 391 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 389 def role_ref @role_ref end |
#trailing_adjective ⇒ Object (readonly)
Returns the value of attribute trailing_adjective.
390 391 392 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 390 def trailing_adjective @trailing_adjective end |
#unit ⇒ Object
Returns the value of attribute unit.
389 390 391 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 389 def unit @unit end |
#value_constraint ⇒ Object (readonly)
Returns the value of attribute value_constraint.
390 391 392 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 390 def value_constraint @value_constraint end |
Instance Method Details
#bind(context) ⇒ Object
432 433 434 435 436 437 438 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 432 def bind context @binding || begin key = "#{@player.name} #{@literal}" @binding = (context.bindings[key] ||= Binding.new(@player)) @binding.refs << self end end |
#binding ⇒ Object
440 441 442 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 440 def binding @binding end |
#identify_other_players(context) ⇒ Object
414 415 416 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 414 def identify_other_players(context) identify_player context end |
#identify_player(context) ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 418 def identify_player context @player || begin player_name = case @literal when String; 'String' when Float; 'Real' when Numeric; 'Integer' when TrueClass, FalseClass; 'Boolean' end v = context.vocabulary @player = v.constellation.ValueType(v, player_name) end end |
#identify_players_with_role_name(context) ⇒ Object
410 411 412 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 410 def identify_players_with_role_name(context) # Nothing to do here, move along end |
#inspect ⇒ Object
400 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 400 def inspect; to_s; end |
#nested_clauses ⇒ Object
398 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 398 def nested_clauses; nil; end |
#player ⇒ Object
406 407 408 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 406 def player @player end |
#role_name ⇒ Object
Stubs:
397 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 397 def role_name; nil; end |
#to_s ⇒ Object
402 403 404 |
# File 'lib/activefacts/cql/compiler/expression.rb', line 402 def to_s unit ? "(#{@literal.to_s} in #{unit.to_s})" : @literal.to_s end |