Skip to content

Instantly share code, notes, and snippets.

@MarioCarrion
Created January 15, 2015 03:28
Show Gist options
  • Save MarioCarrion/19203d195e106deee8d8 to your computer and use it in GitHub Desktop.
Save MarioCarrion/19203d195e106deee8d8 to your computer and use it in GitHub Desktop.
require_relative 'version1'
require_relative 'version2'
module Versioning
class Builder
class << self
def build(version)
version = version.to_i
raise ArgumentError.new("Version not supported: #{version}") if version < 0 || version > 2
return Version1.new if version == 1
return Version2.new
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment