Created
November 29, 2012 20:31
-
-
Save cableray/4171712 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
module CheetahCub | |
class Transaction | |
attr_reader :transaction_delegate | |
delegate :save, to: :transaction_delegate | |
# def save | |
# transaction_delegate.save | |
# end | |
def initialize | |
@transaction_delegate = Config.module_prefix::Transaction.new | |
end | |
end | |
end |
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 'cheetah_cub' | |
CheetahCub::Config.version= "1.1.1" | |
CheetahCub::Transaction.new.save # => Hello from 1.1.1 | |
CheetahCub::Config.version= "1.1.2" | |
CheetahCub::Transaction.new.save # => Hello from 1.1.2 |
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
module CheetahCub | |
module Config | |
extend self | |
attr_accessor :version | |
def url | |
ENV["CHEETAH_CUB_API_URL"] | |
end | |
def module_prefix | |
class_eval("CheetahCub::X_#{version.gsub('.','_')}") | |
end | |
def version= version | |
@version = version | |
end | |
def version | |
@version || '1.1.1' | |
end | |
end | |
end |
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
module CheetahCub | |
module X_1_1_1 | |
class Transaction | |
def save | |
puts "Hello from 1.1.1" | |
end | |
end | |
end | |
end |
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
module CheetahCub | |
module X_1_1_2 | |
class Transaction | |
def save | |
puts "Hello from 1.1.2" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment