class SitemapGenerator::Application
Public Instance Methods
rails3?()
click to toggle source
Returns a boolean indicating whether this environment is Rails 3
@return [Boolean]
# File lib/sitemap_generator/application.rb, line 12 def rails3? rails? && Rails.version.to_f >= 3 rescue false # Rails.version defined in 2.1.0 end
rails?()
click to toggle source
# File lib/sitemap_generator/application.rb, line 5 def rails? defined?(Rails) end
root()
click to toggle source
# File lib/sitemap_generator/application.rb, line 18 def root Pathname.new(rails_root || Dir.getwd) end
Protected Instance Methods
rails_env()
click to toggle source
Returns the environment of the Rails application, if this is running in a Rails context. Returns ‘nil` if no such environment is defined.
@return [String, nil]
# File lib/sitemap_generator/application.rb, line 43 def rails_env return ::Rails.env.to_s if defined?(::Rails.env) return RAILS_ENV.to_s if defined?(RAILS_ENV) return nil end
rails_root()
click to toggle source
Returns the root of the Rails application, if this is running in a Rails context. Returns ‘nil` if no such root is defined.
@return [String, nil]
# File lib/sitemap_generator/application.rb, line 29 def rails_root if defined?(::Rails.root) return ::Rails.root.to_s if ::Rails.root raise "ERROR: Rails.root is nil!" end return RAILS_ROOT.to_s if defined?(RAILS_ROOT) return nil end