{"id":17861162,"url":"https://github.com/jonathanstowe/staticish","last_synced_at":"2025-04-02T20:47:19.070Z","repository":{"id":36420438,"uuid":"40725419","full_name":"jonathanstowe/Staticish","owner":"jonathanstowe","description":"Make a singleton class that wraps the methods so they appear like class methods","archived":false,"fork":false,"pushed_at":"2022-08-07T08:42:56.000Z","size":26,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-22T17:07:00.289Z","etag":null,"topics":["object","raku","singleton","util"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanstowe.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-14T16:38:49.000Z","updated_at":"2022-08-07T08:42:59.000Z","dependencies_parsed_at":"2022-09-03T10:30:20.464Z","dependency_job_id":null,"html_url":"https://github.com/jonathanstowe/Staticish","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FStaticish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FStaticish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FStaticish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FStaticish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanstowe","download_url":"https://codeload.github.com/jonathanstowe/Staticish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246892796,"owners_count":20850846,"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":["object","raku","singleton","util"],"created_at":"2024-10-28T08:43:08.132Z","updated_at":"2025-04-02T20:47:18.935Z","avatar_url":"https://github.com/jonathanstowe.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Staticish\n\nMake a singleton class that wraps the methods so they appear like class methods\n\n![Build Status](https://github.com/jonathanstowe/Staticish/workflows/CI/badge.svg)\n\n## Synopsis\n\n    use Staticish;\n\n    class Foo is Static {\n        has Str $.bar is rw;\n    }\n\n    Foo.bar = \"There you go\";\n    say Foo.bar; # \u003e \"There you go\";\n\n\n## Description\n\nThis provides a mechanism whereby a class can be treated as a \"singleton\"\nand all of its methods wrapped such that if they are called as \"class\"\nor \"static\" methods they will actually be called on the single instance.\nIt does this by applying a role to the class itself which provides a\nconstructor \"new()\"  that will always return the same instance of the\nobject, and by applying a role to the classes Meta class which over-rides\nthe \"add_method\" method in order to wrap the programmer supplied methods\nsuch that if the method is called on the type object (i.e. as a class\nmethod) then the single instance will be obtained and the method will\nbe called with that as the invocant.\n\nThis might be useful for a class such as a configuration parser or\nlogger where a single set of parameters will be used globally within an\napplication and it doesn't make sense to pass a single object around.\n\nIt may not deal with every possible use case properly, but it largely\ndoes what I need it to.  Suggestions, patches etc are welcome.\n\n## Installation\n\nAssuming you have a working Rakudo installation you should be able to install this with *zef* :\n\n    # From the source directory\n   \n    zef install .\n\n    # Remote installation\n\n    zef install Staticish\n\n\n## Support\n\nThis has never worked quite as well as I'd hoped when pre-compiled into another module as it \nflies too close to the wind of what will work.  If you find you hit a problem with it then you\nshould try adding `no precompilation;` to your module before the `use Staticish;`.\n\nSuggestions/patches are welcomed via [github](https://github.com/jonathanstowe/Staticish/issues)\n\n## Licence\n\nThis is free software.\n\nPlease see the [LICENCE](LICENCE) file in the distribution\n\n© Jonathan Stowe 2015 - 2021\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fstaticish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanstowe%2Fstaticish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fstaticish/lists"}