Class: BooleanRule
Instance Method Summary collapse
-
#initialize ⇒ BooleanRule
constructor
A new instance of BooleanRule.
- #result ⇒ Object
- #test(value) ⇒ Object
- #train(meta) ⇒ Object
Constructor Details
#initialize ⇒ BooleanRule
Returns a new instance of BooleanRule.
6 7 8 9 10 |
# File 'lib/rules/BooleanRule.rb', line 6 def initialize() @booleans = Set.new() end |
Instance Method Details
#result ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rules/BooleanRule.rb', line 34 def result() { :type => :bool, :is_true => @booleans.include?, :is_false => @booleans.include? } end |
#test(value) ⇒ Object
28 29 30 31 32 |
# File 'lib/rules/BooleanRule.rb', line 28 def test(value) @booleans.include? value end |
#train(meta) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/rules/BooleanRule.rb', line 15 def train() value = [:value] unless value.nil? @booleans << value end end |