From fa96638bf2c5c97571849715cb8298c7a3b058ca Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sun, 27 Jun 2010 13:08:38 -0300 Subject: Added getbyte as a core_ext to Ruby < 1.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/lib/active_support/core_ext/string/conversions.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/lib/active_support/core_ext') 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? -- cgit v1.2.3