Class: Ruleby::Core::PropertyAtom

Inherits:
Atom
  • Object
show all
Defined in:
lib/core/atoms.rb

Overview

This kind of atom is used to match a simple condition.

For example:

a.person{ |p| p.is_a? Person }

So there are no references to other atoms.

Direct Known Subclasses

BlockAtom, EqualsAtom

Instance Attribute Summary

Attributes inherited from Atom

#deftemplate, #method, #proc, #tag

Instance Method Summary collapse

Methods inherited from Atom

#initialize, #to_s

Constructor Details

This class inherits a constructor from Ruleby::Core::Atom

Instance Method Details

#==(atom) ⇒ Object



38
39
40
# File 'lib/core/atoms.rb', line 38

def ==(atom)      
  return shareable?(atom) && @tag == atom.tag
end

#shareable?(atom) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
# File 'lib/core/atoms.rb', line 42

def shareable?(atom)
  return PropertyAtom === atom && 
         @method == atom.method && 
         @deftemplate == atom.deftemplate && 
         @proc == atom.proc 
end