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

Fix converting in Integer type #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Fix converting in Integer type #26

wants to merge 4 commits into from

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