Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Apr 22, 2010
  1. Move versionable out into a library.

    authored
    The jist:
    
    class Versioned
      include Versionable
    
      def foo; :past_foo; end
      def baz; :baz; end
    
      version "1"
    
      def foo; :foo; end
      def self.bar; :bar; end
    
      version "2" do
        def foo; :future_foo; end
      end
    
      version "3" do
        def foo; :far_future_foo; end
      end
    end
    
    Versioned['0'].new.foo                  # => :past_foo
    Versioned['1'].new.foo                  # => :foo
    Versioned['2'].new.foo                  # => :future_foo
    Versioned['3'].new.foo                  # => :far_future_foo
    Versioned == Versioned['1']             # => true
    Versioned['>= 1'] == Versioned['3']     # => true
    Versioned['< 3'] == Versioned['2']      # => true
    
    Turns out Class#dup can do some crazy things.
    
    The default version (the one you get without a [requirement]) is
    determined by the use of blocks passed to the .version calls.  The
    last call without a block is the default one.
  2. Initial commit to versionable.

    authored
Something went wrong with that request. Please try again.