diff options
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/access.rb | 26 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/conversions.rb | 3 |
2 files changed, 4 insertions, 25 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/access.rb b/activesupport/lib/active_support/core_ext/array/access.rb index a3b2a54c7d..6de338bfcc 100644 --- a/activesupport/lib/active_support/core_ext/array/access.rb +++ b/activesupport/lib/active_support/core_ext/array/access.rb @@ -43,29 +43,9 @@ module ActiveSupport #:nodoc: self[4] end - # Equal to <tt>self[5]</tt>. - def sixth - self[5] - end - - # Equal to <tt>self[6]</tt>. - def seventh - self[6] - end - - # Equal to <tt>self[7]</tt>. - def eighth - self[7] - end - - # Equal to <tt>self[8]</tt>. - def ninth - self[8] - end - - # Equal to <tt>self[9]</tt>. - def tenth - self[9] + # Equal to <tt>self[41]</tt>. Also known as accessing "the reddit". + def forty_two + self[41] end end end diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index cf3e03f62c..f0d6591135 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -1,5 +1,3 @@ -require 'builder' - module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Array #:nodoc: @@ -149,6 +147,7 @@ module ActiveSupport #:nodoc: # def to_xml(options = {}) raise "Not all elements respond to to_xml" unless all? { |e| e.respond_to? :to_xml } + require 'builder' unless defined?(Builder) options[:root] ||= all? { |e| e.is_a?(first.class) && first.class.to_s != "Hash" } ? first.class.to_s.underscore.pluralize : "records" options[:children] ||= options[:root].singularize |