Sha256: 9339f7d984bda09eb9d02b210eda1a3aacf608e7de3bf2021b56f0837b670263

Contents?: true

Size: 437 Bytes

Versions: 14

Compression:

Stored size: 437 Bytes

Contents

module Spruz
  module TimeDummy
    def self.included(modul)
      modul.module_eval do
        class << self
          alias really_new new
        end

        extend ClassMethods

        class << self
          alias now new
        end
      end
    end

    module ClassMethods
      attr_accessor :dummy

      def new
        if dummy
          dummy.dup
        else
          really_new
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
spruz-0.2.10 lib/spruz/time_dummy.rb
spruz-0.2.9 lib/spruz/time_dummy.rb
spruz-0.2.8 lib/spruz/time_dummy.rb
spruz-0.2.7 lib/spruz/time_dummy.rb
spruz-0.2.6 lib/spruz/time_dummy.rb
spruz-0.2.5 lib/spruz/time_dummy.rb
spruz-0.2.2 lib/spruz/time_dummy.rb
spruz-0.2.1 lib/spruz/time_dummy.rb
spruz-0.2.0 lib/spruz/time_dummy.rb
spruz-0.1.5 lib/spruz/time_dummy.rb
spruz-0.1.3 lib/spruz/time_dummy.rb
spruz-0.1.2 lib/spruz/time_dummy.rb
spruz-0.1.1 lib/spruz/time_dummy.rb
spruz-0.1.0 lib/spruz/time_dummy.rb