Sha256: e561d0928ce9157e806e7aead1a1be95917e411b1135f0527f34146f756c7b47

Contents?: true

Size: 835 Bytes

Versions: 6

Compression:

Stored size: 835 Bytes

Contents

# A factory that determines if railroad is running in an application
# framework and if so, returns a "framework" object that handles interacting
# with the framework.  If the factory can not determine find a framework,
# then the factory will return nil.
#
# === Usage
# 
# framework = FrameworkFactory.getFramework
#
# Dec 2008 - Roy Wright
# created to support multiple frameworks
#
class FrameworkFactory
  
  # the factory the returns a "framework" object or nil
  def self.getFramework
    framework = nil
    if File.exist? 'merb'
      require 'railroad/merb_framework'
      framework = MerbFramework.new 
    end
    if File.exist? 'script/server'
      require 'railroad/rails_framework'
      framework = RailsFramework.new 
    end
    framework
  end
  
  private
  
  # prevent instantiation
  def initialize
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
royw-railroad_xing-0.5.0.1 lib/railroad/framework_factory.rb
royw-railroad_xing-0.5.0.2 lib/railroad/framework_factory.rb
royw-railroad_xing-0.5.1 lib/railroad/framework_factory.rb
royw-railroad_xing-0.5.2 lib/railroad/framework_factory.rb
royw-railroad_xing-0.5.3 lib/railroad/framework_factory.rb
dmattes-railroad_xing-0.5.4 lib/railroad/framework_factory.rb