Module DRP::RuleEngine
In: lib/rule_engine.rb

Methods

Included Modules

InstanceMethods

Public Instance methods

TODO find way of making rdoc document these even if they are private

NB the two methods defined via define_method in end_rules will be instance methods in instances of classes which are extended by this module. they are here because they are closures referencing the ‘name’ and ‘all_methods’ variables respectively. other non-closure methods are in module InstanceMethods

sets the maximum obtainable depth of the rule methods which follow it in the listing. max_depths are set for each instance of the class you extended with DRP::RuleEngine upon initialization (or when you call init_drp), once and only once, and remains set to that static value. max depths are always integer values.

it may be used in any of the following four ways:

scalar, all following rule_methods are set to given value

 max_depth 1

range, each following rule_method is initialized to some integer from range.start to range.end inclusive using a linear mapping of a codon gotten via the method next_meta_codon.

 max_depth 1..2

same as the previous but uses the function given, at present the only function implemented is i_linear (integer linear), which is the default action when no function is given, so at present this is useless.

 max_depth 1..2, :function

block, each following rule_method is initialized to some integer given by your block. the formal parameters to your supplied block are counted, and the appropriate number of codons harvested using InstanceMethods#next_meta_codon are passed to the block.

 max_depth { |next_meta_codon, ...| ... }

see example_2.rb

sets the weight of the rule methods which follow it in the listing, and may be used in any of the following four ways:

scalar, all following rule_methods are set to given value

max_depth 1

range, each following rule_method is initialized to some integer from range.start to range.end inclusive using a linear mapping of a codon gotten via the method next_meta_codon when your extended object is initialized via drp_init.

max_depth 1..2

same as the previous but uses the function given, at present the only function implemented is i_linear (integer linear), which is the default action when no function is given, so at present this is useless.

max_depth 1..2, :function

block, each following rule_method is initialized to some integer given by your block upon a call to drp_init, i.e. when you initialize your extended object instance. the formal parameters to your supplied block are counted, and the appropriate number of codons harvested using InstanceMethods#next_meta_codon are passed to the block.

max_depth { |next_meta_codon, …| … }

[Validate]