{"id":25003791,"url":"https://github.com/lpogic/koper","last_synced_at":"2025-06-28T07:32:50.222Z","repository":{"id":224907912,"uuid":"764567848","full_name":"lpogic/koper","owner":"lpogic","description":"Controversial standard class operator set","archived":false,"fork":false,"pushed_at":"2024-05-28T21:57:25.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T10:55:56.594Z","etag":null,"topics":["operators","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lpogic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-28T10:11:24.000Z","updated_at":"2024-05-28T21:57:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9262411-e254-4df9-a570-fe570c6cd5c4","html_url":"https://github.com/lpogic/koper","commit_stats":null,"previous_names":["lpogic/koper"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpogic%2Fkoper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpogic%2Fkoper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpogic%2Fkoper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lpogic%2Fkoper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lpogic","download_url":"https://codeload.github.com/lpogic/koper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249221,"owners_count":20747168,"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":["operators","ruby"],"created_at":"2025-02-04T22:39:03.009Z","updated_at":"2025-03-29T22:12:41.474Z","avatar_url":"https://github.com/lpogic.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"koper - Controversial standard class operator set\n===\n\nIt extends some standard classes with operators whose mathematical and logical meaning is difficult to justify.\n\n\nInstallation\n---\n```\ngem install koper\n```\n\nUsage\n---\n### 1. Complete example\n```RUBY\nrequire 'koper'\n\nhash = {\n  a: 1,\n  b: 2\n}\n\np hash / :a        # =\u003e 1 (#fetch or #fetch_values if right side is an Enumerable)\np hash / [:b, :a]  # =\u003e [2, 1]\np hash \u0026 :a        # =\u003e {:a=\u003e1} (#slice or #slice with splat if right side is an Enumerable)\np hash \u0026 [:b, :a]  # =\u003e {:b=\u003e2, :a=\u003e1}\np !hash            # =\u003e {1=\u003e:a, 2=\u003e:b} (#invert)\np hash + {c: 3}    # =\u003e {:a=\u003e1, :b=\u003e2, :c=\u003e3} (#merge)\n\narray = [3, 4, 5, 6]\n\np array / 2        # =\u003e 5 (#[] alias)\np array \u003e\u003e 2       # =\u003e [3, 4] (like #pop but returns self)\np array \u003e\u003e 1 \u003c\u003c 8  # =\u003e [3, 8] (last element swap)\np array[] = 9      # =\u003e 9 (like #push but returns right side argument)\n```\n\n### 2. Digging\n```RUBY\nrequire 'koper'\n\nhash = {\n  a: 1,\n  b: {\n    c: 2\n  },\n  d: [\n    5,\n    {\n      e: 5\n    }\n  ]\n}\n\np hash/:b/:c    # =\u003e 2\np hash/:x/:y    # =\u003e nil\np hash/:d/1/:e  # =\u003e 5\n```\n\n\nAuthors\n---\n- Łukasz Pomietło (oficjalnyadreslukasza@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpogic%2Fkoper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flpogic%2Fkoper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flpogic%2Fkoper/lists"}