hoodwink.d enhanced

Sat May 12

Homewrecker

Nick Lowe

Verifier (from a rule engine)

# Encapsulates some object and executes expressions # in the context of that object tracking the result # of the evaluation. As soon as an expression is # false, the verification fails. # # verification = Verifier.new('Marcel') do # try { size == 6 } # Passes # try { size == 5 } # Fails # try { raise } # Doesn't get here # end # # verification.verify # => false class Verifier class FailedVerification < Exception end class << self def verify(object, &block) new(object, &block).verify end end attr_reader :object, :results, :block def initialize(object, &block) @object = object @results = [] @verified = false @block = block end def verified? @verified && results.all? end def verify instance_eval(&block) @verified = true rescue FailedVerification false end def try(&block) results << object.instance_exec(&block) raise FailedVerification if results.last == false end end

Chantaburi No. 1


Designing a Stinkless Durian

1 2 3 4 by Feist

Brides-maid

Wedding down time