{"id":15561048,"url":"https://github.com/zhisme/lazy_names","last_synced_at":"2025-04-23T21:47:51.452Z","repository":{"id":56880844,"uuid":"315702167","full_name":"zhisme/lazy_names","owner":"zhisme","description":"Ease your console typing with redefining constants by shorter version","archived":false,"fork":false,"pushed_at":"2025-03-26T21:14:05.000Z","size":43,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-26T22:25:06.269Z","etag":null,"topics":["console","constants","irb","pry","ruby"],"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/zhisme.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-24T17:14:50.000Z","updated_at":"2025-03-26T21:14:08.000Z","dependencies_parsed_at":"2024-02-19T17:16:27.399Z","dependency_job_id":"98aeda6f-a1e5-46a3-bdef-457d37eed58b","html_url":"https://github.com/zhisme/lazy_names","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"9ec5e48bb09499696728900c21e550544726b3c7"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhisme%2Flazy_names","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhisme%2Flazy_names/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhisme%2Flazy_names/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhisme%2Flazy_names/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhisme","download_url":"https://codeload.github.com/zhisme/lazy_names/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522297,"owners_count":21444510,"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":["console","constants","irb","pry","ruby"],"created_at":"2024-10-02T16:05:02.687Z","updated_at":"2025-04-23T21:47:51.432Z","avatar_url":"https://github.com/zhisme.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![rake](https://github.com/zhisme/lazy_names/actions/workflows/rake.yml/badge.svg)](https://github.com/zhisme/lazy_names/actions/workflows/rake.yml)\n[![Gem Version](https://badge.fury.io/rb/lazy_names.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/lazy_names)\n![Gem Total Downloads](https://img.shields.io/gem/dt/lazy_names)\n[![Hits-of-Code](https://hitsofcode.com/github/zhisme/lazy_names?branch=master)](https://hitsofcode.com/github/zhisme/lazy_names/view?branch=master)\n[![codecov](https://codecov.io/gh/zhisme/lazy_names/graph/badge.svg?token=ZQXGBALJSK)](https://codecov.io/gh/zhisme/lazy_names)\n![GitHub License](https://img.shields.io/github/license/zhisme/lazy_names)\n\n# lazy_names\n\nlazy_names helps programmer to type faster very-long class names constants by defining them on a shorter version.\nIf you are lazy like me typing many times a day in console long constants then this gem will ease your development process.\n\n## Why\n\nConsider this example from pry terminal session.\n![Lazy names in action](https://media.giphy.com/media/7CtRJfp2yocsOu9zEA/source.gif)\n\nThe idea is to reduce typing of long namespaced constants to shorter versions. It's very useful when you have a lot of nested namespaces and you need to access them frequently. This gem will take your responsibility to redefine constants to shorter versions and making constant/classes validations.\n\n## Installation\n\n1. Add this line to your application's Gemfile:\n\n```ruby\ngroup :development do\n  gem 'lazy_names'\nend\n```\n2. Setup your console to automatically load lazy names\n\n- If you are using pry, add this line to `~/.pryrc` or per project `myproject/.pryrc`\n\n```ruby\nif defined?(LazyNames)\n  Pry.config.hooks.add_hook(:when_started, :lazy_names) do\n    LazyNames.load_definitions!\n  end\nend\n```\n\n- If you are using irb, add this line to `~/.irbrc` or per project `myproject/.irbrc`\n\n```ruby\nif defined?(LazyNames)\n  LazyNames.load_definitions!\nend\n```\n\n3. And then execute:\n```bash\nbundle\n```\n\n4. Create your own lazy_names config where you define constants\n```bash\ncp .lazy_names.tt.yml ~/.lazy_names.yml\n```\n\n5. Login into your rails or non-rails console\n```bash\n$ bundle exec rails c # or bin/console\n# your shorter version of constants are available now, enjoy!\n```\n\n## Configuration\n\n### Global definition\n\nTake a look onto `lazy_names.tt.yml` it has very basic template for you to start.\n\n```yml\n---\nmy_awesome_project:\n  definitions:\n    'Models::Users::CreditCard': 'MUCC'\n```\n`my_awesome_project` should be you project/folder name\n\nSo consider this example:\n```sh\n$ pwd\n/Users/name/my_awesome_project\n```\nThe last folder name of you ruby project must match the same one in your configuration.\nAfter **definitions** sections you can actually redefine your long constants.\nSo in this example `Models::Users::CreditCard` is your real project constant and\n`MUCC` will be your short variant of it, so you can access `Models::Users::CreditCard`\nfrom `MUCC`. `MUCC` and any other right hand side can be any value, you define the best-suitable names.\n\nYou can define as many constants as you want. The same rule applies for projects.\nYour config can have multiple constant definitions per namespace.\n```yml\n---\nmy_awesome_project:\n  definitions:\n    'Models::Users::CreditCard': 'MUCC'\nmy_another_project:\n  definitions:\n    'OtherLongConst': 'Short'\n```\n\n### Project definitions\n\nIn the meantime you can put your `.lazy_names.yml` config directly to project folder, it will be looked up firstly from project.\nJust do not forget to put in your `.gitignore`. I believe every developer defines shorter versions of constants by his own opinion.\n```sh\necho '.lazy_names.yml' \u003e\u003e .gitignore\n```\nIf project folder doesn't contain any `.lazy_names.yml`, it will fallback to home directory.\n\nConfiguration per project a bit different: you don't need to specify global scope `my_awesome_project`, you can skip forward to definitions\n```yml\n---\ndefinitions:\n  'Models::Users::CreditCard: 'MUCC'\n```\nExample config can be found in `.lazy_names.tt.project.yml`\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\nAfter you make changes ensure to run `rake rubocop` to check if your code meets linter standards.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/zhisme/lazy_names.\nEnsure the CI build is green by validating tests are passing and coverage is not decreased.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhisme%2Flazy_names","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhisme%2Flazy_names","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhisme%2Flazy_names/lists"}