Class: Rules
- Inherits:
-
Object
- Object
- Rules
- Defined in:
- lib/hrules.rb
Constant Summary collapse
- @@rules =
[]
Instance Attribute Summary collapse
-
#character ⇒ Object
Returns the value of attribute character.
-
#mutation ⇒ Object
Returns the value of attribute mutation.
-
#param_count ⇒ Object
Returns the value of attribute param_count.
-
#takes_param ⇒ Object
Returns the value of attribute takes_param.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(character, mutation, takes_param, param_count) ⇒ Rules
constructor
A new instance of Rules.
- #takes_parameters? ⇒ Boolean
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
#character ⇒ Object
Returns the value of attribute character.
205 206 207 |
# File 'lib/hrules.rb', line 205 def character @character end |
#mutation ⇒ Object
Returns the value of attribute mutation.
205 206 207 |
# File 'lib/hrules.rb', line 205 def mutation @mutation end |
#param_count ⇒ Object
Returns the value of attribute param_count.
205 206 207 |
# File 'lib/hrules.rb', line 205 def param_count @param_count end |
#takes_param ⇒ Object
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_rules ⇒ Object
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
219 220 221 |
# File 'lib/hrules.rb', line 219 def takes_parameters? self.takes_param end |