module TingYun::Frameworks::ClassMethods

Public Instance Methods

instance() click to toggle source
# File lib/ting_yun/frameworks/class_methods.rb, line 10
def instance
  framework = TingYun::Agent.config[:framework]
  if framework == :test
    @instance ||= load_test_framework
  else
    @instance ||= load_framework_class(framework).new(local_env)
  end

end
load_framework_class(framework) click to toggle source
# File lib/ting_yun/frameworks/class_methods.rb, line 27
def load_framework_class(framework)
  begin
    require 'ting_yun/frameworks/' + framework.to_s
  rescue LoadError
    #to avoid error
  end
  TingYun::Frameworks.const_get(framework.to_s.capitalize)
end
load_test_framework() click to toggle source
# File lib/ting_yun/frameworks/class_methods.rb, line 20
def load_test_framework
  config = File.expand_path(File.join('..','..', 'test','config','tingyun.yml'), __FILE__)
  require 'config/test'
  TingYun::Frameworks::Test.new(local_env, config)
end
local_env() click to toggle source
# File lib/ting_yun/frameworks/class_methods.rb, line 36
def local_env
  @local_env ||= TingYun::Support::LocalEnvironment.new
end
reset() click to toggle source

clear out memoized Framework and LocalEnv instances

# File lib/ting_yun/frameworks/class_methods.rb, line 41
def reset
  @instance = nil
  @local_env = nil
end