{"id":15490472,"url":"https://github.com/tsukasaoishi/n_adic_number","last_synced_at":"2025-10-26T10:31:06.624Z","repository":{"id":11428901,"uuid":"13882050","full_name":"tsukasaoishi/n_adic_number","owner":"tsukasaoishi","description":"NAdicNumber treats N-adic Number","archived":false,"fork":false,"pushed_at":"2021-01-19T14:22:43.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-31T18:14:37.833Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsukasaoishi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-26T11:10:08.000Z","updated_at":"2022-05-23T13:44:37.000Z","dependencies_parsed_at":"2022-09-13T17:51:30.929Z","dependency_job_id":null,"html_url":"https://github.com/tsukasaoishi/n_adic_number","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukasaoishi%2Fn_adic_number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukasaoishi%2Fn_adic_number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukasaoishi%2Fn_adic_number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukasaoishi%2Fn_adic_number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsukasaoishi","download_url":"https://codeload.github.com/tsukasaoishi/n_adic_number/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238310283,"owners_count":19450835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby"],"created_at":"2024-10-02T07:21:31.834Z","updated_at":"2025-10-26T10:31:01.356Z","avatar_url":"https://github.com/tsukasaoishi.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAdicNumber\n\n[![Gem Version](https://badge.fury.io/rb/n_adic_number.svg)](http://badge.fury.io/rb/n_adic_number) [![Build Status](https://travis-ci.org/tsukasaoishi/n_adic_number.svg?branch=master)](https://travis-ci.org/tsukasaoishi/n_adic_number) [![Code Climate](https://codeclimate.com/github/tsukasaoishi/n_adic_number/badges/gpa.svg)](https://codeclimate.com/github/tsukasaoishi/n_adic_number)\n\nNAdicNumber treats N-adic Number.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'n_adic_number'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install n_adic_number\n\n## Usage\nNAdicNumber::Base.mapping is setting map table of N-adic Number.\nFor example, 16-adic:\n\n    class NumberObBase16 \u003c NAdicNumber::Base\n      mapping [\"0\"..\"9\", \"a\"..\"f\"].map{|r| r.to_s}.flatten\n    end\n\nFor example, 94-adic:\n\n    class NumberObBase94 \u003c NAdicNumber::Base\n      mapping (33..126).map{|i| i.chr}\n    end\n\nSample:\n\n    class NumberOfBase62 \u003c NAdicNumber::Base\n      mapping [\"0\"..\"9\", \"A\"..\"Z\", \"a\"..\"z\"].map{|r| r.to_a}.flatter\n    end\n\n    one = NumberOfBase62.new(1)\n    sixty_two = NumberOfBase62.new(62)\n\n    one.to_s #=\u003e \"1\"\n    sixty_two.to_s #=\u003e \"z\"\n    one.to_i #=\u003e 1\n    sixty_two.to_i =\u003e 62\n\n    sum = one + sixty_two\n    sum.to_i #=\u003e 63\n    sum.to_s #=\u003e \"10\"\n\n    sum += 100\n    sum.to_s #=\u003e \"2d\"\n    sum.to_i #=\u003e 163\n\n    all_a = NumberOfBase62.new(\"aaaaa\")\n    all_a.to_s #=\u003e \"aaaaa\"\n    all_a.to_i #=\u003e 540668556\n\n\n\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukasaoishi%2Fn_adic_number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsukasaoishi%2Fn_adic_number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukasaoishi%2Fn_adic_number/lists"}