{"id":18026802,"url":"https://github.com/yegor256/decoor","last_synced_at":"2026-01-04T21:51:09.162Z","repository":{"id":245405597,"uuid":"818152980","full_name":"yegor256/decoor","owner":"yegor256","description":"True Object-Oriented Decorator for either an Object or a Class","archived":false,"fork":false,"pushed_at":"2024-09-17T08:42:21.000Z","size":41,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-17T13:06:02.651Z","etag":null,"topics":["decorator","decorator-pattern","decorators","oop","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/decoor","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/yegor256.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":"2024-06-21T08:01:24.000Z","updated_at":"2024-09-16T10:56:57.000Z","dependencies_parsed_at":"2024-06-22T01:34:16.508Z","dependency_job_id":"fe90c70c-3f3a-44d7-8015-d4d0c85a78b6","html_url":"https://github.com/yegor256/decoor","commit_stats":null,"previous_names":["yegor256/decoor"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fdecoor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fdecoor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fdecoor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fdecoor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yegor256","download_url":"https://codeload.github.com/yegor256/decoor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245764711,"owners_count":20668464,"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":["decorator","decorator-pattern","decorators","oop","ruby"],"created_at":"2024-10-30T08:08:07.107Z","updated_at":"2026-01-04T21:51:09.157Z","avatar_url":"https://github.com/yegor256.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# True Object-Oriented Decorator\n\n[![DevOps By Rultor.com](https://www.rultor.com/b/yegor256/decoor)](https://www.rultor.com/p/yegor256/decoor)\n[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)\n\n[![rake](https://github.com/yegor256/decoor/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/decoor/actions/workflows/rake.yml)\n[![PDD status](https://www.0pdd.com/svg?name=yegor256/decoor)](https://www.0pdd.com/p?name=yegor256/decoor)\n[![Gem Version](https://badge.fury.io/rb/decoor.svg)](https://badge.fury.io/rb/decoor)\n[![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/decoor.svg)](https://codecov.io/github/yegor256/decoor?branch=master)\n[![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/github/yegor256/decoor/master/frames)\n[![Hits-of-Code](https://hitsofcode.com/github/yegor256/decoor)](https://hitsofcode.com/view/github/yegor256/decoor)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/decoor/blob/master/LICENSE.txt)\n\nLet's say, you have an object that you want to decorate, thus\nadding new attributes and methods to it. Here is how:\n\n```ruby\nrequire 'decoor'\ns = ' Jeff Lebowski '\nd = decoor(s, br: ' ') do\n  def parts\n    @origin.strip.split(@br)\n  end\nend\nassert(d.parts == ['Jeff', 'Lebowski'])\n```\n\nYou may also turn an existing class into a decorator:\n\n```ruby\nrequire 'decoor'\nclass MyString\n  def initialize(s, br)\n    @s = s\n    @br = br\n  end\n  decoor(:s)\n  def parts\n    @origin.strip.split(@br)\n  end\nend\nd = MyString.new('Jeff Lebowski', ' ')\nassert(d.parts == ['Jeff', 'Lebowski'])\n```\n\nThat's it.\n\n## How to contribute\n\nRead\n[these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).\nMake sure your build is green before you contribute\nyour pull request. You will need to have\n[Ruby](https://www.ruby-lang.org/en/) 3.2+ and\n[Bundler](https://bundler.io/) installed. Then:\n\n```bash\nbundle update\nbundle exec rake\n```\n\nIf it's clean and you don't see any error messages, submit your pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegor256%2Fdecoor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyegor256%2Fdecoor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegor256%2Fdecoor/lists"}