aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/string
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-06-27 13:08:38 -0300
committerJosé Valim <jose.valim@gmail.com>2010-06-27 20:30:24 +0200
commitfa96638bf2c5c97571849715cb8298c7a3b058ca (patch)
tree241b5346b815c5575bc36abd8be3f73e0cbf07cc /activesupport/lib/active_support/core_ext/string
parent0c0b0aa0f223523331afdc157fb3992a121bf497 (diff)
downloadrails-fa96638bf2c5c97571849715cb8298c7a3b058ca.tar.gz
rails-fa96638bf2c5c97571849715cb8298c7a3b058ca.tar.bz2
rails-fa96638bf2c5c97571849715cb8298c7a3b058ca.zip
Added getbyte as a core_ext to Ruby < 1.9
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support/core_ext/string')
-rw-r--r--activesupport/lib/active_support/core_ext/string/conversions.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/conversions.rb b/activesupport/lib/active_support/core_ext/string/conversions.rb
index 6a243fe982..af277f9995 100644
--- a/activesupport/lib/active_support/core_ext/string/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/string/conversions.rb
@@ -28,6 +28,10 @@ class String
self[0]
end unless method_defined?(:ord)
+ def getbyte(index)
+ self[index]
+ end if RUBY_VERSION < '1.9'
+
# Form can be either :utc (default) or :local.
def to_time(form = :utc)
return nil if self.blank?