Class: Wongi::Engine::DSL::Clause::Has
- Inherits:
-
Struct
- Object
- Struct
- Wongi::Engine::DSL::Clause::Has
- Includes:
- CoreExt
- Defined in:
- lib/wongi-engine/dsl/clause/fact.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#predicate ⇒ Object
Returns the value of attribute predicate.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
- #compile(context) ⇒ Object
-
#initialize(s, p, o, options = {}) ⇒ Has
constructor
A new instance of Has.
- #inspect ⇒ Object
Methods included from CoreExt
Constructor Details
#initialize(s, p, o, options = {}) ⇒ Has
Returns a new instance of Has.
7 8 9 10 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 7 def initialize(s, p, o, = {}) debug! if [:debug] super(s, p, o) end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object
3 4 5 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 3 def object @object end |
#predicate ⇒ Object
Returns the value of attribute predicate
3 4 5 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 3 def predicate @predicate end |
#subject ⇒ Object
Returns the value of attribute subject
3 4 5 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 3 def subject @subject end |
Instance Method Details
#compile(context) ⇒ Object
12 13 14 15 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 12 def compile(context) tests, assignment = parse_variables(context) context.tap { |c| c.join_node(self, tests, assignment) } end |
#inspect ⇒ Object
17 18 19 |
# File 'lib/wongi-engine/dsl/clause/fact.rb', line 17 def inspect "<+#{subject.inspect} #{predicate.inspect} #{object.inspect}>" end |