{"id":16956983,"url":"https://github.com/jgraichen/proc-value","last_synced_at":"2025-04-11T21:44:07.752Z","repository":{"id":9868025,"uuid":"11866962","full_name":"jgraichen/proc-value","owner":"jgraichen","description":"Take Smalltalks `#value` to Ruby. Dead easy transparent block usage.","archived":false,"fork":false,"pushed_at":"2025-02-17T06:52:35.000Z","size":22,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T16:46:18.034Z","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/jgraichen.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":"2013-08-03T17:38:43.000Z","updated_at":"2025-02-17T06:52:38.000Z","dependencies_parsed_at":"2025-01-27T05:32:42.013Z","dependency_job_id":null,"html_url":"https://github.com/jgraichen/proc-value","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"9478e8218155a454d8b2f288a2d57f238e56c308"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fproc-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fproc-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fproc-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgraichen%2Fproc-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgraichen","download_url":"https://codeload.github.com/jgraichen/proc-value/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487373,"owners_count":21112185,"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-10-13T22:16:33.758Z","updated_at":"2025-04-11T21:44:07.727Z","avatar_url":"https://github.com/jgraichen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proc::Value\n\n[![Gem Version](https://img.shields.io/gem/v/proc-value?logo=ruby)](https://rubygems.org/gems/proc-value)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/jgraichen/proc-value/test.yml?logo=github)](https://github.com/jgraichen/proc-value/actions/workflows/test.yml)\n[![Code Coverage](https://img.shields.io/codecov/c/gh/jgraichen/proc-value?logo=codecov)](https://codecov.io/gh/jgraichen/proc-value)\n\n**Proc::Value** extends Ruby Objects with a Smalltalk like `#value` method that always returns the object except when called on a block. In this case the block will be evaluated and the result returned. This allows the transparent exchange of static object with lazy evaluated blocks e.g. for configuration classes.\n\n```ruby\nclass Configuration\n  def initialize(options)\n    @options = options\n  end\n\n  def path\n  \t@options[:path].value.to_s\n  end\nend\n\nconfig1 = Configuration.new path: proc { \"config/#{RAILS_ENV}/config.yml\" }\nconfig2 = Configuration.new path: 'config/config.yml'\n\nconfig1.path # `path` block will be evaluated here!\n             # =\u003e \"config/development/config.yml\"\nconfig2.path # Same code. No extra if statement needed.\n             # =\u003e \"config/config.yml\"\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'proc-value'\n```\n\nAnd then execute:\n\n```console\nbundle\n```\n\nOr install it yourself as:\n\n```console\ngem install proc-value\n```\n\n## Usage\n\nSee example above.\n\nYou can also use `Proc.val(proc_or_object)` that does not depend on any injected method and only looks if given object implements a `#call` method or not.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Add specs for your feature\n4. Add and commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fproc-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgraichen%2Fproc-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgraichen%2Fproc-value/lists"}