{"id":15033241,"url":"https://github.com/arturictus/miller","last_synced_at":"2026-02-25T15:02:40.453Z","repository":{"id":56883714,"uuid":"157901299","full_name":"arturictus/miller","owner":"arturictus","description":"DSL constructor","archived":false,"fork":false,"pushed_at":"2020-02-29T14:40:04.000Z","size":24,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T11:13:34.228Z","etag":null,"topics":["dsl","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/arturictus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-16T17:38:49.000Z","updated_at":"2023-07-21T10:37:26.000Z","dependencies_parsed_at":"2022-08-20T23:40:22.515Z","dependency_job_id":null,"html_url":"https://github.com/arturictus/miller","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/arturictus%2Fmiller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturictus%2Fmiller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturictus%2Fmiller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arturictus%2Fmiller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arturictus","download_url":"https://codeload.github.com/arturictus/miller/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280272,"owners_count":20912967,"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":["dsl","ruby"],"created_at":"2024-09-24T20:20:28.694Z","updated_at":"2025-10-28T07:16:21.960Z","avatar_url":"https://github.com/arturictus.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Miller\n\nWrite beautiful and descriptive code by adding configurable services with DSLs\nin a quick and easy manner.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'miller'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install miller\n\n## Usage\n\n```ruby\nclass ServiceBase\n  include Miller.with(:name, :lastname)\n  def full_name\n    \"#{name} #{lastname}\"\n  end\n  # write your logic here\nend\n\nclass Service \u003c ServiceBase\n  name 'John'\n  lastname 'Doe'\nend\n\nService.config.name # =\u003e 'John'\nService.config.lastname # =\u003e 'Doe'\ninst = Service.new\ninst.name # =\u003e 'John'\ninst.lastname # =\u003e 'Doe'\ninst.full_name # =\u003e 'John Doe'\n```\n\n__IMPORTANT:__ Usually you will create a base class and then inherit from it for clarity as the previous example shows. The following examples are just to explain the features.\n\n### Blocks\n\n```ruby\n  class Service\n    include Miller.with(:name, :lastname)\n    name { another_name }\n    lastname 'Doe'\n\n    def another_name\n      \"victor\"\n    end\n  end\n  Service.config.name # =\u003e Proc\n  Service.config.lastname # =\u003e 'Doe'\n  inst = Service.new\n  inst.name # =\u003e 'victor'\n  inst.lastname # =\u003e 'Doe'\n```\n\n### Default Config\n\n```ruby\n  class Service\n    include Miller.with(:name, :lastname, default_config: { name: 'Henry', lastname: 'Miller' })\n    lastname 'Doe'\n  end\n  Service.config.name # =\u003e 'Henry'\n  Service.config.lastname # =\u003e 'Doe'\n  inst = Service.new\n  inst.name # =\u003e 'Henry'\n  inst.lastname # =\u003e 'Doe'\n```\n\n### Inheritance\n\nIf you require configs to be inherited by children use the following.\n\n```ruby\n  class ServiceBase \u003c Miller.base(:name, :lastname)\n    name 'John'\n    lastname 'Doe'\n  end\n  class Service \u003c ServiceBase; end\n  Service.config.name # =\u003e 'John'\n  Service.config.lastname # =\u003e 'Doe'\n  inst = Service.new\n  inst.name # =\u003e 'John'\n  inst.lastname # =\u003e 'Doe'\n```\n\n### Override at instance level\n\n__WARNING:__ This can be useful but very dangerous please use it carefully.\n\n```ruby\n  class Service\n    include Miller.with(:name, :lastname)\n    name 'John'\n    lastname 'Doe'\n  end\n  Service.config.name # =\u003e 'John'\n  Service.config.lastname # =\u003e 'Doe'\n  inst = Service.new\n  inst.name = 'Henry'\n  inst.name # =\u003e 'Henry'\n  inst.lastname # =\u003e 'Doe'\n```\n\n```ruby\n  class Service\n    include Miller.with(:name, :lastname)\n    name 'John'\n    lastname 'Doe'\n    def another_name\n      'Martha'\n    end\n  end\n  Service.config.name # =\u003e 'John'\n  Service.config.lastname # =\u003e 'Doe'\n  inst = Service.new\n  inst.name = proc { another_name }\n  inst.name # =\u003e 'Martha'\n  inst.lastname # =\u003e 'Doe'\n```\n\n### Errors\n\n```ruby\n  class Service\n    include Miller.with(:name, :lastname)\n    name 'John'\n    lastname 'Doe'\n  end\n  Service.config.foo # =\u003e Miller::ConfigNotSetError\n```\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.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/miller. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Miller project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/miller/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturictus%2Fmiller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farturictus%2Fmiller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farturictus%2Fmiller/lists"}