{"id":18103290,"url":"https://github.com/roberwil/ada_numbers_gem","last_synced_at":"2026-02-12T15:34:43.740Z","repository":{"id":147124418,"uuid":"615536125","full_name":"roberwil/ada_numbers_gem","owner":"roberwil","description":"It converts a number to its equivalent in written words, i.e. 123 to \"cento e vinte três\" or to \"one hundred and twenty-three\", and vice versa.","archived":false,"fork":false,"pushed_at":"2023-03-30T08:21:42.000Z","size":87,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-29T15:23:56.373Z","etag":null,"topics":["ruby","ruby-gem","ruby-on-rails","rubygems"],"latest_commit_sha":null,"homepage":"","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/roberwil.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-17T23:40:49.000Z","updated_at":"2023-03-30T05:02:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"94e1f7bb-bbc4-404b-8883-46660a9d2f9f","html_url":"https://github.com/roberwil/ada_numbers_gem","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/roberwil/ada_numbers_gem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberwil%2Fada_numbers_gem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberwil%2Fada_numbers_gem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberwil%2Fada_numbers_gem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberwil%2Fada_numbers_gem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roberwil","download_url":"https://codeload.github.com/roberwil/ada_numbers_gem/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roberwil%2Fada_numbers_gem/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29370548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","ruby-gem","ruby-on-rails","rubygems"],"created_at":"2024-10-31T22:11:36.593Z","updated_at":"2026-02-12T15:34:43.726Z","avatar_url":"https://github.com/roberwil.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ada Numbers\n\nSame as [Ada.Numbers](https://github.com/roberwil/ada_numbers), but for Ruby folks :D\n\n- It converts a number to its equivalent in written words, i.e. 123 to \"cento e vinte três\" or 123 to\n  \"one hundred and twenty-three\" depending on the chosen language;\n- It converts a word to its equivalent in number, i.e. \"cento e vinte dois\" to \"122\" or \"one hundred and twenty-two\"\n  to \"122\".\n\n**Note: `ada_numbers` supports numbers with a maximum of 15 digits.**\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ada_numbers'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install ada_numbers\n\n## Usage\n\n## Features:\n\n\nTo use every feature, simply\n```ruby\nrequire 'ada_numbers'\n```\n\nConverters support 2 global parameters:\n\n- Language;\n- Scale.\n\nTo set the **language**, it is done as follows:\n\n```ruby\n# To use english\nAdaNumbers::Settings.language = AdaNumbers::Settings::Parameters::LANGUAGES[:en]\n# To use portuguese\nAdaNumbers::Settings.language = AdaNumbers::Settings::Parameters::LANGUAGES[:pt]\n```\n\nTo set the **scale**, it is done as follows:\n\n```ruby\n# To use short scale\nAdaNumbers::Settings.scale = AdaNumbers::Settings::Parameters::SCALES[:short]\n# To use long scale\nAdaNumbers::Settings.scale = AdaNumbers::Settings::Parameters::SCALES[:long]\n```\n\nTo learn more about scales, read [this](https://en.wikipedia.org/wiki/Long_and_short_scales).\n\nThe Settings are global, meaning that once they are set, every operation is affected, so, in order to\nhave a different behavior, the Settings must be explicitly set.\nPer default, Language is **Portuguese** and the Scale is **Long**.\n\nTo convert **number to words**, use `.to_n` or `.to_number` or using the class methods directly (less recommended):\n\n```ruby\nAdaNumbers::WordsToNumberConverter::En.convert \"two\"  # \u003e 2\nAdaNumbers::WordsToNumberConverter::Pt.convert \"Dois\" # \u003e 2\n```\n\nExamples:\n\n```ruby\nnumber = \"vinte e dois\"\nnumber.to_n # \u003e 22\n\nAdaNumbers::Settings.language = AdaNumbers::Settings::Parameters::LANGUAGES[:en] # converters will now use english\nnumber = \"twenty-two\"\nnumber.to_n # \u003e \"22\"\n```\n\nTo convert **number to words**, use `.to_w` or `.to_words` or using the class methods directly (less recommended):\n\n```ruby\nAdaNumbers::NumberToWordsConverter::En.convert 2 # \u003e \"Two\"\nAdaNumbers::NumberToWordsConverter::Pt.convert 2 # \u003e \"Dois\"\n```\n\n```ruby\nnumber = 22;\nnumber.to_w # \u003e \"Vinte e Dois\"\n\nAdaNumbers::Settings.language = AdaNumbers::Settings::Parameters::LANGUAGES[:en] # converters will now use english\nnumber = 22;\nnumber.to_w # \u003e \"Twenty-two\"\n```\n\nIf, for some reason, whichever object your trie to convert is invalid for the converters,\n`Message::INVALID_NUMER` will be returned.\n\nSome utilities are also available, such as:\n\n- `.number_of_digits` to know the number of digits of a number\n\n```ruby\nnumber = 22;\nnumber.n_digits # \u003e 2\n```\n\n- `.category` to know the category of the number.\n\n```ruby\nnumber = 22;\nnumber.category # \u003e NumberCategory::Ten\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test`\nto run the tests. You can also run `bin/console` for an interactive prompt that will allow\nyou to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a\nnew version, update the version number in `version.rb`, and then run `bundle exec rake release`,\nwhich will create a git tag for the version, push git commits and tags, and push the `.gem`\nfile to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/roberwil/ada_numbers_gem.\nThis project is intended to be a safe, welcoming space for collaboration, and contributors are\nexpected to adhere to the [code of conduct](https://github.com/roberwil/ada_numbers_gem/blob/main/CODE_OF_CONDUCT.md).\n\n\n## Code of Conduct\n\nEveryone interacting in the AdaNumbers project's codebases, issue trackers, chat rooms and\nmailing lists is expected to follow the [code of conduct](https://github.com/roberwil/ada_numbers_gem/blob/main/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froberwil%2Fada_numbers_gem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froberwil%2Fada_numbers_gem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froberwil%2Fada_numbers_gem/lists"}