Class: Clive::Argument::AlwaysTrue
- Inherits:
-
Object
- Object
- Clive::Argument::AlwaysTrue
- Defined in:
- lib/clive/argument.rb
Overview
Creates an object which will respond with true to all call to the method(s) given.
Class Method Summary collapse
Class Method Details
.for(*syms) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/clive/argument.rb', line 20 def self.for(*syms) c = Class.new syms.each do |sym| c.send(:define_method, sym) {|*a| true } end c.send(:define_method, :inspect) { "#<AlwaysTrue #{syms.map {|i| ":#{i}" }.join(', ') }>" } c.new end |