Class: Ruleby::Core::Template

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

Overview

This class encapsulates the criteria the HeadAtom uses to match. The clazz attribute represents a Class type, and the mode defines whether the head will match only class that are exactly a particular type, or if it will match classes that inherit that type also.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(clazz, mode = :equals) ⇒ Template

Returns a new instance of Template.



170
171
172
173
# File 'lib/core/atoms.rb', line 170

def initialize(clazz,mode=:equals)
  @clazz = clazz
  @mode = mode
end

Instance Attribute Details

#clazzObject (readonly)

Returns the value of attribute clazz.



167
168
169
# File 'lib/core/atoms.rb', line 167

def clazz
  @clazz
end

#modeObject (readonly)

Returns the value of attribute mode.



168
169
170
# File 'lib/core/atoms.rb', line 168

def mode
  @mode
end

Instance Method Details

#==(df) ⇒ Object



175
176
177
# File 'lib/core/atoms.rb', line 175

def ==(df)
  Template === df && df.clazz == @clazz && df.mode == @mode
end