Class: Ruleby::Core::DefTemplate

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) ⇒ DefTemplate

Returns a new instance of DefTemplate.



143
144
145
146
# File 'lib/core/atoms.rb', line 143

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

Instance Attribute Details

#clazzObject (readonly)

Returns the value of attribute clazz.



140
141
142
# File 'lib/core/atoms.rb', line 140

def clazz
  @clazz
end

#modeObject (readonly)

Returns the value of attribute mode.



141
142
143
# File 'lib/core/atoms.rb', line 141

def mode
  @mode
end

Instance Method Details

#==(df) ⇒ Object



148
149
150
# File 'lib/core/atoms.rb', line 148

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