Skip to content

Instantly share code, notes, and snippets.

@alexis
Created September 8, 2011 18:17
Show Gist options
  • Save alexis/1204165 to your computer and use it in GitHub Desktop.
Save alexis/1204165 to your computer and use it in GitHub Desktop.
code4
include FactChecker
define_fact :festivals, :if => lambda{|o| o.festivals > 0}
define_fact :scenario, :if => :scenario?
define_fact :requiest => [:festivals, :scenario], :if => :equipment?
define_fact :members => :request, :if => lambda{|o| o.members > 0}
define_fact :basic_info => :request, :if => lambda{|o| o.name.present? && o.description.present?}
define_fact :submit => [:members, :basic_info], :if => :submitted?
@ipoval
Copy link

ipoval commented Sep 8, 2011

Do you think this can be used as a short-cut alternative for positive predicate?
def_fact :f1 => :f2 do |f|
f.festivals > 0
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment