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
#deftemplate, #method, #proc, #tag
Instance Method Summary collapse
- #==(atom) ⇒ Object
-
#initialize(tag, method, vars, deftemplate, &block) ⇒ ReferenceAtom
constructor
A new instance of ReferenceAtom.
- #shareable?(atom) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(tag, method, vars, deftemplate, &block) ⇒ ReferenceAtom
Returns a new instance of ReferenceAtom.
107 108 109 110 |
# File 'lib/core/atoms.rb', line 107 def initialize(tag, method, vars, deftemplate, &block) super(tag, method, deftemplate, &block) @vars = vars # list of referenced variable names end |
Instance Attribute Details
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
105 106 107 |
# File 'lib/core/atoms.rb', line 105 def vars @vars end |
Instance Method Details
#==(atom) ⇒ Object
116 117 118 119 120 121 122 |
# File 'lib/core/atoms.rb', line 116 def ==(atom) return ReferenceAtom === atom && @proc == atom.proc && @tag == atom.tag && @vars == atom.vars && @deftemplate == atom.deftemplate end |
#shareable?(atom) ⇒ Boolean
112 113 114 |
# File 'lib/core/atoms.rb', line 112 def shareable?(atom) false end |
#to_s ⇒ Object
124 125 126 |
# File 'lib/core/atoms.rb', line 124 def to_s return super + ", vars=#{vars.join(',')}" end |