Class: Ruleby::Core::ReferenceAtom
Overview
This kind of atom is used for matching a value that is a variable. For example:
#name == #:your_name
The expression for this atom depends on some other atom.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
Attributes inherited from Atom
Instance Method Summary collapse
- #==(atom) ⇒ Object
-
#initialize(tag, slot, vars, template, block) ⇒ ReferenceAtom
constructor
A new instance of ReferenceAtom.
- #shareable?(atom) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(tag, slot, vars, template, block) ⇒ ReferenceAtom
Returns a new instance of ReferenceAtom.
134 135 136 137 |
# File 'lib/core/atoms.rb', line 134 def initialize(tag, slot, vars, template, block) super(tag, slot, template, block) @vars = vars # list of referenced variable names end |
Instance Attribute Details
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
132 133 134 |
# File 'lib/core/atoms.rb', line 132 def vars @vars end |
Instance Method Details
#==(atom) ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/core/atoms.rb', line 143 def ==(atom) ReferenceAtom === atom && @proc == atom.proc && @tag == atom.tag && @vars == atom.vars && @template == atom.template end |
#shareable?(atom) ⇒ Boolean
139 140 141 |
# File 'lib/core/atoms.rb', line 139 def shareable?(atom) false end |
#to_s ⇒ Object
151 152 153 |
# File 'lib/core/atoms.rb', line 151 def to_s super + ", vars=#{vars.join(',')}" end |