Created
January 15, 2015 03:28
-
-
Save MarioCarrion/19203d195e106deee8d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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