Class: Rules

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

Constant Summary collapse

@@rules =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(character, mutation, takes_param, param_count) ⇒ Rules

Returns a new instance of Rules.



207
208
209
210
211
212
213
# File 'lib/hrules.rb', line 207

def initialize(character, mutation, takes_param, param_count)
	@character   = character
	@mutation    = mutation
	@takes_param = takes_param
	@param_count = param_count
	@@rules << self
end

Instance Attribute Details

#characterObject

Returns the value of attribute character.



205
206
207
# File 'lib/hrules.rb', line 205

def character
  @character
end

#mutationObject

Returns the value of attribute mutation.



205
206
207
# File 'lib/hrules.rb', line 205

def mutation
  @mutation
end

#param_countObject

Returns the value of attribute param_count.



205
206
207
# File 'lib/hrules.rb', line 205

def param_count
  @param_count
end

#takes_paramObject

Returns the value of attribute takes_param.



205
206
207
# File 'lib/hrules.rb', line 205

def takes_param
  @takes_param
end

Class Method Details

.all_rulesObject



223
224
225
# File 'lib/hrules.rb', line 223

def self.all_rules
	@@rules
end

.find_rule(character) ⇒ Object



215
216
217
# File 'lib/hrules.rb', line 215

def self.find_rule(character)
	@@rules.select { |r| r.character == character }.first
end

Instance Method Details

#takes_parameters?Boolean

Returns:

  • (Boolean)


219
220
221
# File 'lib/hrules.rb', line 219

def takes_parameters?
	self.takes_param
end