class Philtre::PredicateDsl
This is a specialised module that also understands a simple DSL for creating predicates as methods.
This is how the DSL works: each meth is a predicate, args is a set of alternatives and the block must return something convertible to a Sequel.expr to create the expression for that predicate.
Public Class Methods
new( &bloc )
click to toggle source
# File lib/philtre/predicate_dsl.rb, line 10 def initialize( &bloc ) if bloc if bloc.arity == 0 module_eval &bloc else bloc.call self end end end
Public Instance Methods
method_missing(meth, *args, &bloc)
click to toggle source
# File lib/philtre/predicate_dsl.rb, line 20 def method_missing(meth, *args, &bloc) define_method meth, &bloc args.each{|arg| send :alias_method, arg, meth } end