Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove language-specific methods of String#hex

The leading underscore case is handled by the primitive.
  • Loading branch information...
commit 780e6e8957eecb3f003dcdba6df6a377cb429b40 1 parent 110f350
@zaeleus zaeleus authored
View
12 kernel/common/string.rb
@@ -721,6 +721,18 @@ def oct
to_inum(-8, false)
end
+ # Treats leading characters from <i>self</i> as a string of hexadecimal digits
+ # (with an optional sign and an optional <code>0x</code>) and returns the
+ # corresponding number. Zero is returned on error.
+ #
+ # "0x0a".hex #=> 10
+ # "-1234".hex #=> -4660
+ # "0".hex #=> 0
+ # "wombat".hex #=> 0
+ def hex
+ to_inum(16, false)
+ end
+
def reverse
dup.reverse!
end
View
12 kernel/common/string18.rb
@@ -12,18 +12,6 @@ def self.allocate
alias_method :bytesize, :size
- # Treats leading characters from <i>self</i> as a string of hexadecimal digits
- # (with an optional sign and an optional <code>0x</code>) and returns the
- # corresponding number. Zero is returned on error.
- #
- # "0x0a".hex #=> 10
- # "-1234".hex #=> -4660
- # "0".hex #=> 0
- # "wombat".hex #=> 0
- def hex
- to_inum(16, false)
- end
-
def upto(stop, exclusive=false)
stop = StringValue(stop)
return self if self > stop
View
5 kernel/common/string19.rb
@@ -46,11 +46,6 @@ def force_encoding(enc)
self
end
- def hex
- return 0 if self.chars.first == "_"
- to_inum(16, false)
- end
-
def prepend(other)
self[0,0] = other
self
Please sign in to comment.
Something went wrong with that request. Please try again.