{"id":18026832,"url":"https://github.com/yegor256/veils","last_synced_at":"2025-03-27T01:31:28.217Z","repository":{"id":56897346,"uuid":"262233045","full_name":"yegor256/veils","owner":"yegor256","description":"Ruby Veil Objects","archived":false,"fork":false,"pushed_at":"2024-05-22T11:41:38.000Z","size":97,"stargazers_count":14,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-22T12:47:15.802Z","etag":null,"topics":["caching","object-oriented-programming","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"https://www.yegor256.com/2020/05/19/veil-objects.html","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":"2020-05-08T05:14:30.000Z","updated_at":"2024-05-31T09:58:54.301Z","dependencies_parsed_at":"2024-01-24T14:34:51.453Z","dependency_job_id":"89452675-2dc4-4017-a05e-fbfd33c4c3c9","html_url":"https://github.com/yegor256/veils","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.125,"last_synced_commit":"0aa784f3fdbe22ed87da378fc061093ea87923e3"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fveils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fveils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fveils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yegor256%2Fveils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yegor256","download_url":"https://codeload.github.com/yegor256/veils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245764717,"owners_count":20668466,"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":["caching","object-oriented-programming","ruby","ruby-gem"],"created_at":"2024-10-30T08:08:13.856Z","updated_at":"2025-03-27T01:31:28.211Z","avatar_url":"https://github.com/yegor256.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"/logo.svg\" width=\"64px\" height=\"64px\"/\u003e\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/veils)](http://www.rultor.com/p/yegor256/veils)\n[![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)\n\n[![rake](https://github.com/yegor256/veils/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/veils/actions/workflows/rake.yml)\n[![Gem Version](https://badge.fury.io/rb/veils.svg)](http://badge.fury.io/rb/veils)\n[![Maintainability](https://api.codeclimate.com/v1/badges/51b007d0eb24ceeeca94/maintainability)](https://codeclimate.com/github/yegor256/veils/maintainability)\n[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/veils/master/frames)\n[![Hits-of-Code](https://hitsofcode.com/github/yegor256/veils)](https://hitsofcode.com/view/github/yegor256/veils)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/veils/blob/master/LICENSE.txt)\n\nRead this blog post first:\n[Veil Objects to Replace DTOs](https://www.yegor256.com/2020/05/19/veil-objects.html)\n\nFirst, install it:\n\n```bash\n$ gem install veils\n```\n\nThen, use it like this:\n\n```ruby\nrequire 'veil'\nobj = Veil.new(obj, to_s: 'Hello, world!')\n```\n\nThe method `to_s` will return `Hello, world!` until some other\nmethod is called and the veil is \"pierced.\"\n\nYou can also use `Unpiercable` decorator, which will never be pierced:\na very good instrument for data memoization.\n\nYou can also try `AlterOut`, which lets you modify the output\nof object methods on fly:\n\n```ruby\nrequire 'alterout'\nobj = AlterOut.new(obj, to_s: proc { |s| s + 'extra tail' })\n```\n\nThere is also `AlterIn` decorator, to modify incoming method arguments\n(the result of the `proc` will replace the list of input arguments):\n\n```ruby\nrequire 'alterin'\nobj = AlterIn.new(obj, print: proc { |i| [i + 1] })\n```\n\nKeep in mind that all classes are thread-safe.\n\n## How to contribute\n\nRead [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 [Ruby](https://www.ruby-lang.org/en/) 2.3+ and\n[Bundler](https://bundler.io/) installed. Then:\n\n```\n$ bundle update\n$ bundle 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%2Fveils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyegor256%2Fveils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyegor256%2Fveils/lists"}