Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

for YARD

  • Loading branch information...
commit 870df30f3f80f13dfcd9c06756f9d6d73dffd8c8 1 parent 16de510
@kachick authored
Showing with 11 additions and 5 deletions.
  1. +2 −1  lib/integer/base/eigen.rb
  2. +9 −4 lib/integer/base/ext.rb
View
3  lib/integer/base/eigen.rb
@@ -30,13 +30,14 @@ def convert_to_string(num, chars)
return chars.first.to_s if int == 0
''.tap {|s|
- n = int
+ n = int.abs
until (n, excess = n.divmod base; n == 0 && excess == 0)
s << chars[excess].to_s
end
s.reverse!
+ s.insert 0, '-' if int < 0
}
end
View
13 lib/integer/base/ext.rb
@@ -5,8 +5,10 @@ class String
remove_method :to_i
- # @param [Fixnum] base
- # @param [Array<String>] base
+ # @overload to_i(base_number)
+ # @param [Fixnum] base_number Delegate to standard to_i
+ # @overload to_i(positional_chars)
+ # @param [Array<#to_sym>] positional_chars
# @return [Integer]
def to_i(base=10)
case base
@@ -34,8 +36,11 @@ def Integer(obj)
end
class Integer
- # @param [Fixnum] base
- # @param [Array<String>] base
+
+ # @overload to_s(base_number)
+ # @param [Fixnum] base_number Delegate to standard to_s
+ # @overload to_s(positional_chars)
+ # @param [Array<#to_sym>] positional_chars
# @return [String]
def to_s(base=10)
case base
Please sign in to comment.
Something went wrong with that request. Please try again.