aboutsummaryrefslogtreecommitdiffstats
path: root/railties/builtin
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-12-19 04:21:02 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-12-19 04:21:02 +0000
commit16c3ec7b2807f2f57d86399e6f62163a8962ec8b (patch)
treedeb08b87f6e9cb338dae94fdf5bce343db347686 /railties/builtin
parent11a75f9a3801d544194e90423ff5f16ffc0eb21e (diff)
downloadrails-16c3ec7b2807f2f57d86399e6f62163a8962ec8b.tar.gz
rails-16c3ec7b2807f2f57d86399e6f62163a8962ec8b.tar.bz2
rails-16c3ec7b2807f2f57d86399e6f62163a8962ec8b.zip
Simplify some rails info methods
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8436 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/builtin')
-rw-r--r--railties/builtin/rails_info/rails/info.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/railties/builtin/rails_info/rails/info.rb b/railties/builtin/rails_info/rails/info.rb
index c8bc9cb4f1..2bd9b55617 100644
--- a/railties/builtin/rails_info/rails/info.rb
+++ b/railties/builtin/rails_info/rails/info.rb
@@ -3,11 +3,11 @@ module Rails
mattr_accessor :properties
class << (@@properties = [])
def names
- map { |name, value| name }
+ map &:first
end
def value_for(property_name)
- if property = find { |name, value| name == property_name }
+ if property = assoc(property_name)
property.last
end
end
@@ -16,19 +16,19 @@ module Rails
class << self #:nodoc:
def property(name, value = nil)
value ||= yield
- properties << [name, value] if value
+ properties << [name, value] if value
rescue Exception
end
def components
%w( active_record action_pack active_resource action_mailer active_support )
end
-
+
def component_version(component)
require "#{component}/version"
"#{component.classify}::VERSION::STRING".constantize
end
-
+
def edge_rails_revision(info = svn_info)
info[/^Revision: (\d+)/, 1] || freeze_edge_version
end
@@ -51,7 +51,7 @@ module Rails
end
alias inspect to_s
-
+
def to_html
returning table = '<table>' do
properties.each do |(name, value)|
@@ -84,25 +84,25 @@ module Rails
property 'RubyGems version' do
Gem::RubyGemsVersion
end
-
+
# The Rails version.
property 'Rails version' do
Rails::VERSION::STRING
end
-
- # Versions of each Rails component (Active Record, Action Pack,
+
+ # Versions of each Rails component (Active Record, Action Pack,
# Active Resource, Action Mailer, and Active Support).
components.each do |component|
- property "#{component.titlecase} version" do
+ property "#{component.titlecase} version" do
component_version(component)
end
end
-
+
# The Rails SVN revision, if it's checked out into vendor/rails.
property 'Edge Rails revision' do
edge_rails_revision
end
-
+
# The application's location on the filesystem.
property 'Application root' do
File.expand_path(RAILS_ROOT)
@@ -112,7 +112,7 @@ module Rails
property 'Environment' do
RAILS_ENV
end
-
+
# The name of the database adapter for the current environment.
property 'Database adapter' do
ActiveRecord::Base.configurations[RAILS_ENV]['adapter']