class SitemapGenerator::Application
Public Instance Methods
is_at_least_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 is_at_least_rails3? is_rails? && Rails.version.to_f >= 3 rescue false # Rails.version defined in 2.1.0 end
is_rails?()
click to toggle source
# File lib/sitemap_generator/application.rb, line 5 def is_rails? !!defined?(Rails::VERSION) 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 40 def rails_env return ::Rails.env.to_s if defined?(::Rails.env) return RAILS_ENV.to_s if defined?(RAILS_ENV) 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 return ::Rails.root.to_s if defined?(::Rails.root) && ::Rails.root return RAILS_ROOT.to_s if defined?(RAILS_ROOT) nil end