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.

Instance Attribute Summary collapse

Attributes inherited from Atom

#deftemplate, #method, #proc, #tag

Instance Method Summary collapse

Methods inherited from PropertyAtom

#==

Methods inherited from Atom

#to_s

Constructor Details

#initialize(tag, method, deftemplate, value) ⇒ EqualsAtom

Returns a new instance of EqualsAtom.



67
68
69
70
# File 'lib/core/atoms.rb', line 67

def initialize(tag, method, deftemplate, value)
  super(tag,method,deftemplate)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



66
67
68
# File 'lib/core/atoms.rb', line 66

def value
  @value
end

Instance Method Details

#shareable?(atom) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
75
76
# File 'lib/core/atoms.rb', line 72

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