lib/githug/extensions/grit/ruby1.9.rb in githug-0.3.0 vs lib/githug/extensions/grit/ruby1.9.rb in githug-0.3.1
- old
+ new
@@ -1,7 +1,17 @@
class String
- if ((defined? RUBY_VERSION) && (RUBY_VERSION[0..2] == "1.9" || RUBY_VERSION.split(".")[0].to_i >= 2))
+ if self.method_defined?(:ord)
def getord(offset); self[offset].ord; end
else
alias :getord :[]
end
+
+ unless self.method_defined?(:b)
+ if self.method_defined?(:force_encoding)
+ def b; self.dup.force_encoding(Encoding::ASCII_8BIT); end
+ else
+ def b; self.dup; end
+ end
+ end
end
+
+PACK_IDX_SIGNATURE = "\377tOc".b