Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Fix converting in Integer type#26

Open
AnotherRegularDude wants to merge 4 commits intoenthrops:masterfrom
AnotherRegularDude:fix/fix-integer-converting
Open

Fix converting in Integer type#26
AnotherRegularDude wants to merge 4 commits intoenthrops:masterfrom
AnotherRegularDude:fix/fix-integer-converting

Conversation

@AnotherRegularDude
Copy link

From documentation about Kernel#Integer:

If arg is a String, when base is omitted or equals zero, radix indicators (0, 0b, and 0x) are honored.

So, usually, when a string is converted to a number, assumed that the string has a decimal number system
But now:

class Test
  include Tainbox

  attribute :age, :Integer
end

t = Test.new(age: "012")
p t.age #=> 10

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant