Class: Ruleby::Core::HeadAtom
Overview
This kind of atom is used to match a class type. For example:
'For each Person as :p'
It is only used at the start of a pattern.
Instance Attribute Summary
Attributes inherited from Atom
#deftemplate, #method, #proc, #tag
Instance Method Summary collapse
-
#initialize(tag, deftemplate) ⇒ HeadAtom
constructor
A new instance of HeadAtom.
- #shareable?(atom) ⇒ Boolean
Methods inherited from Atom
Constructor Details
#initialize(tag, deftemplate) ⇒ HeadAtom
85 86 87 88 89 90 91 |
# File 'lib/core/atoms.rb', line 85 def initialize(tag, deftemplate) if deftemplate.mode == :equals super tag, :class, deftemplate do |t| t == deftemplate.clazz end elsif deftemplate.mode == :inherits super tag, :class, deftemplate do |t| t === deftemplate.clazz end end end |
Instance Method Details
#shareable?(atom) ⇒ Boolean
93 94 95 |
# File 'lib/core/atoms.rb', line 93 def shareable?(atom) return HeadAtom === atom && @deftemplate == atom.deftemplate end |