Sha256: 3188c02bf4acb440974ae08c76f1e2bcac3f3d81429f3cc7df1889434ea29c5b

Contents?: true

Size: 912 Bytes

Versions: 4

Compression:

Stored size: 912 Bytes

Contents

require 'ostruct'
require 'forwardable'

require 'rack'
require 'haml'
require 'uglifier'
require 'sprockets'

require_relative 'rail/application'
require_relative 'rail/browser'
require_relative 'rail/pipeline'
require_relative 'rail/request'
require_relative 'rail/server'
require_relative 'rail/support'
require_relative 'rail/version'

Sprockets.register_engine('.haml', Tilt::HamlTemplate)

module Rail
  def self.env
    @env ||= build_env
  end

  def self.applications
    ObjectSpace.each_object(Class).select do |klass|
      klass < Application
    end
  end

  private

  def self.build_env
    string = ENV['RAIL_ENV'] ? ENV['RAIL_ENV'].dup : 'development'

    string.singleton_class.class_eval do
      define_method(:method_missing) do |name, *arguments, &block|
        super unless name.to_s =~ /^(?<name>.+)\?$/
        self == Regexp.last_match(:name)
      end
    end

    string
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rail-0.0.5 lib/rail.rb
rail-0.0.4 lib/rail.rb
rail-0.0.3 lib/rail.rb
rail-0.0.2 lib/rail.rb