Class: TeaDrinker
- Inherits:
-
Object
show all
- Includes:
- Ruler
- Defined in:
- bin/example.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Ruler
#default_rule, #dynamic_fact, #fact, #multi_ruleset, #notf, #rule, #ruleset
Constructor Details
Returns a new instance of TeaDrinker.
9
10
11
|
# File 'bin/example.rb', line 9
def initialize
@DEBUG = true
end
|
Instance Attribute Details
#tea ⇒ Object
Returns the value of attribute tea.
7
8
9
|
# File 'bin/example.rb', line 7
def tea
@tea
end
|
Instance Method Details
#drink_iced_tea ⇒ Object
17
18
19
|
# File 'bin/example.rb', line 17
def drink_iced_tea
puts "Ahhhhhhh"
end
|
#make_iced_tea ⇒ Object
13
14
15
|
# File 'bin/example.rb', line 13
def make_iced_tea
puts "Making tea"
end
|
#tea_check(outside_temp) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'bin/example.rb', line 25
def tea_check outside_temp
ruleset do
fact :it_is_hot do outside_temp >= 100.0 end
fact :iced_tea_made, true
fact :no_iced_tea, notf(:iced_tea_made)
fact :am_thirsty, self.thirsty?
rule [:it_is_hot, :am_thirsty, :no_iced_tea] do
make_iced_tea
end
rule [:it_is_hot, :am_thirsty, :iced_tea_made] do
drink_iced_tea
end
end
end
|
#thirsty? ⇒ Boolean
21
22
23
|
# File 'bin/example.rb', line 21
def thirsty?
true
end
|