lib/rulebow/ruleset.rb
# Defines a fact. Facts define conditions that are used to trigger
# rules. Named facts are defined as methods to ensure that only one fact
# is ever defined for a given name. Calling fact again with the same name
# as a previously defined fact will redefine the condition of that fact.
#
# Examples
#   fact :no_doc? do
#     File.directory?('doc')
#   end
#
# Returns the name if name and condition is given. [Symbol]
# Returns a fact in only name or condition is given. [Fact]
Defines a fact. Facts define conditions that are used to trigger
rules. Named facts are defined as methods to ensure that only one fact
is ever defined for a given name. Calling fact again with the same name
as a previously defined fact will redefine the condition of that fact.



Returns the name if name and condition is given. [Symbol]
Returns a fact in only name or condition is given. [Fact]
Defines a fact . Facts define conditions that are used to trigger rules . Named facts are defined as methods to ensure that only one fact is ever defined for a given name . Calling fact again with the same name as a previously defined fact will redefine the condition of that fact . Returns the name if name and condition is given . [ Symbol ] Returns a fact in only name or condition is given . [ Fact ]
def fact(name=nil, &condition)
      if name && conditon
        define_method(name) do
          Fact.new(&condition)  
        end
        name
      else
        define_fact(name || condition)
      end
    end
def fact ( name = nil , & condition ) if name && conditon define_method ( name ) do Fact . new ( & condition ) end name else define_fact ( name || condition ) end end
Defines a fact.
Defines a fact .
# TODO: maybe we don't really need the cache after all
name
<not_specific>
condition
<not_specific>