lib/sham.rb in notahat-machinist-0.1.6 vs lib/sham.rb in notahat-machinist-0.1.7

- old
+ new

@@ -22,9 +22,19 @@ def self.reset @@shams.values.each(&:reset) end + def self.define(&block) + definer = Object.new + class << definer + def method_missing(*args, &block) + Sham.send(*args, &block) + end + end + definer.instance_eval(&block) + end + def initialize(name, options = {}, &block) @name = name @generator = block @offset = 0 @unique = options.has_key?(:unique) ? options[:unique] : true