Class: Rools::Facts
Instance Attribute Summary collapse
-
#fact_value ⇒ Object
readonly
Returns the value of attribute fact_value.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(rule_set, name, b) ⇒ Facts
constructor
A new instance of Facts.
- #to_s ⇒ Object
- #value ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(rule_set, name, b) ⇒ Facts
Returns a new instance of Facts.
12 13 14 15 16 |
# File 'lib/rools/facts.rb', line 12 def initialize(rule_set, name, b) @name = name @fact_value = instance_eval( &b ) #logger.debug "New Facts: #{@fact_value}" if logger end |
Instance Attribute Details
#fact_value ⇒ Object (readonly)
Returns the value of attribute fact_value.
10 11 12 |
# File 'lib/rools/facts.rb', line 10 def fact_value @fact_value end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/rools/facts.rb', line 10 def name @name end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/rools/facts.rb', line 26 def to_s "facts: #{name} #{fact_value.to_s}" end |
#value ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rools/facts.rb', line 18 def value if @fact_value.respond_to?("size") && @fact_value.size == 1 @fact_value[0] else @fact_value end end |