Class: Ruleby::Core::EqualsAtom

Inherits:
PropertyAtom show all
Defined in:
lib/core/atoms.rb

Overview

This kind of atom is used to match just a single, hard coded value.

For example:

a.name == 'John'

So there are no references to other atoms.

Constant Summary collapse

EQUAL_PROC =
lambda {|x, y| x == y}

Instance Attribute Summary

Attributes inherited from PropertyAtom

#value

Attributes inherited from Atom

#proc, #slot, #tag, #template

Instance Method Summary collapse

Methods inherited from PropertyAtom

#==

Methods inherited from Atom

#to_s

Constructor Details

#initialize(tag, slot, template, value) ⇒ EqualsAtom

Returns a new instance of EqualsAtom.



92
93
94
# File 'lib/core/atoms.rb', line 92

def initialize(tag, slot, template, value)
  super(tag,slot,template, value, EQUAL_PROC)
end

Instance Method Details

#shareable?(atom) ⇒ Boolean

Returns:

  • (Boolean)


96
97
98
99
100
# File 'lib/core/atoms.rb', line 96

def shareable?(atom)
  EqualsAtom === atom &&
         @slot == atom.slot &&
         @template == atom.template
end