{"id":22980996,"url":"https://github.com/rubyworks/paramix","last_synced_at":"2025-06-27T02:35:20.714Z","repository":{"id":658737,"uuid":"301556","full_name":"rubyworks/paramix","owner":"rubyworks","description":"Parmetric Mixins","archived":false,"fork":false,"pushed_at":"2015-04-01T23:11:07.000Z","size":622,"stargazers_count":25,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-30T14:17:49.899Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rubyworks.github.com/paramix/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rubyworks.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-09-09T00:01:03.000Z","updated_at":"2023-02-02T09:25:06.000Z","dependencies_parsed_at":"2022-07-08T07:49:22.412Z","dependency_job_id":null,"html_url":"https://github.com/rubyworks/paramix","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/rubyworks%2Fparamix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fparamix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fparamix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fparamix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubyworks","download_url":"https://codeload.github.com/rubyworks/paramix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229773540,"owners_count":18122031,"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-12-15T01:46:34.637Z","updated_at":"2024-12-15T01:46:35.219Z","avatar_url":"https://github.com/rubyworks.png","language":"Ruby","readme":"# Paramix\n\n[![Gem Version](https://badge.fury.io/rb/paramix.png)](http://badge.fury.io/rb/paramix)\n[![Build Status](https://secure.travis-ci.org/rubyworks/paramix.png)](http://travis-ci.org/rubyworks/paramix) \u0026nbsp; \u0026nbsp;\n[![Flattr Me](http://api.flattr.com/button/flattr-badge-large.png)](http://flattr.com/thing/324911/Rubyworks-Ruby-Development-Fund)\n\n[Website](http://rubyworks.github.com/paramix) \u0026middot;\n[YARD API](http://rubydoc.info/gems/paramix) \u0026middot;\n[Report Issue](http://github.com/rubyworks/paramix/issues) \u0026middot;\n[Source Code](http://github.com/rubyworks/paramix)\n\n\n## About\n\nParametric Mixins provides an easy means to \"functionalize\" modules.\nThe module can then be differentiated upon usage according to the\nparameters provided.\n\n\n## Usage\n\nHere is the most basic example. It simply makes the parametric module's\nparameters available at the instance level.\n\n    module M\n      include Paramix::Parametric\n\n      paramaterized do |params|\n        define_method :params do\n          params\n        end\n      end\n\n      def hello\n        \"Hello, %s!\" % [params[:name]]\n      end\n    end\n\n    class X\n      include M[:name=\u003e'Charlie']\n    end\n\n    X.new.hello  #=\u003e 'Hello, Charlie!'\n\nBecause the +parameterized+ method defines a block that is evaluated in the\ncontext of a new Parametric::Mixin, it is possible to work with the parameters\nin more versitle ways. Here is a simple example that uses a parameter to\ndefine a method and another parameter to define it's return value.\n\n    module M\n      include Paramix::Parametric\n\n      paramaterized do |params|\n        define_method params[:name] do\n          params[:value]\n        end\n      end\n    end\n\n    class X\n      include M[:name=\u003e'foo', :value='bar']\n    end\n\n    X.new.foo  #=\u003e 'bar'\n\n\n## Copyrights\n\nCopyright (c) 2006 Rubyworks\n\nThis program is ditributed unser the terms of the BSD-2-Clause license.\n\nSee COPYING.rdoc file for details.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fparamix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyworks%2Fparamix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fparamix/lists"}