{"id":18319775,"url":"https://github.com/redding/much-config","last_synced_at":"2025-04-09T14:22:42.393Z","repository":{"id":49226175,"uuid":"379285630","full_name":"redding/much-config","owner":"redding","description":"Configuration for Ruby objects.","archived":false,"fork":false,"pushed_at":"2022-04-05T15:13:41.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-15T08:19:52.449Z","etag":null,"topics":[],"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/redding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-22T13:48:17.000Z","updated_at":"2021-06-22T19:42:57.000Z","dependencies_parsed_at":"2022-08-20T23:40:40.225Z","dependency_job_id":null,"html_url":"https://github.com/redding/much-config","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redding%2Fmuch-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redding","download_url":"https://codeload.github.com/redding/much-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054200,"owners_count":21039952,"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":[],"created_at":"2024-11-05T18:14:13.150Z","updated_at":"2025-04-09T14:22:42.370Z","avatar_url":"https://github.com/redding.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MuchConfig\n\nConfiguration for Ruby objects.\n\n## Usage\n\nMixin MuchConfig in your e.g. `MyClass` Ruby object. Call the `add_config` DSL method and define `MyClass::Config`:\n\n```ruby\nmodule MyClass\n  include MuchConfig\n\n  add_config\n\n  def self.value1\n    config.value1\n  end\n\n  class Config\n    attr_accessor :value1\n\n    def initialize\n      @value1 = \"default value for `value1`\"\n    end\n  end\nend\n```\n\nConfigure MyClass using the MuchConfig API:\n\n```ruby\nMyClass.config.value1 = \"a custom value\"\n\n# OR\n\nMyClass.configure do |config|\n  config.value1 = \"a custom value\"\nend\n```\n\n### Define multiple named configs\n\nYou can define multiple named configs, e.g.:\n\n```ruby\nmodule MyClass\n  include MuchConfig\n\n  add_config :values\n  add_config :settings\n\n  def self.value1\n    values_config.value1\n  end\n\n  def self.setting1\n    settings_config.setting1\n  end\n\n  class ValuesConfig\n    attr_accessor :value1\n\n    def initialize\n      @value1 = \"default value for `value1`\"\n    end\n  end\n\n  class SettingsConfig\n    attr_accessor :setting1\n\n    def initialize\n      @setting1 = \"default value for `setting1`\"\n    end\n  end\nend\n```\n\nConfigure using the MuchConfig API:\n\n```ruby\nMyClass.values_config.value1 = \"a custom value\"\nMyClass.settings_config.setting1 = \"a custom value\"\n\n# OR\n\nMyClass.configure_values do |config|\n  config.value1 = \"a custom value\"\nend\nMyClass.configure_settings do |config|\n  config.setting1 = \"a custom value\"\nend\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem \"much-config\"\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install much-config\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 \"Added 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%2Fredding%2Fmuch-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredding%2Fmuch-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredding%2Fmuch-config/lists"}