Sha256: 6723eaed062362acd83ad4e6ed4e4459ab9480b900af2cd9294f74befcb2ff04

Contents?: true

Size: 715 Bytes

Versions: 5

Compression:

Stored size: 715 Bytes

Contents

module Checked
class Demand
module Mods
module Bools
        
  def self.before_apply d
  end

  def self.apply? d
    target = d.target
    target.is_a?( FalseClass ) ||
      target.is_a?(TrueClass)
  end
  
  def self.after_apply d
  end

  def be! meth, *args
    answer = target.send meth, *args
    demand answer, :bool!
    return true if answer
    fail!("...failed #{meth} with #{args.inspect}")
  end

  def not_be! meth, *args
    bool!
    pass = target.send(meth, *args)
    demand pass, :bool!
    return true unless pass
    fail!("...#{meth} should not be true with #{args.inspect}")
  end
        
end # === module Bools      
end # === module Mods
end # === class Demand
end # === module Checked

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
Checked-0.1.4 lib/Checked/Demand/Mods/Bools.rb
Checked-0.1.3 lib/Checked/Demand/Mods/Bools.rb
Checked-0.1.2 lib/Checked/Demand/Mods/Bools.rb
Checked-0.1.1 lib/Checked/Demand/Mods/Bools.rb
Checked-0.1.0 lib/Checked/Demand/Mods/Bools.rb