singleton
Version, currently 0.0.13 versions
- 0.0.3latestNov 29, 2016
- 0.0.2not indexedNov 29, 2016
- 0.0.1not indexedNov 29, 2016
github.com/topaz-crystal/crystal-singleton
No description declared in shard.yml.
Nothing has been indexed for 0.0.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
singleton:
github: topaz-crystal/crystal-singleton
version: ~> 0.0.1Then run:
shards installshard.yml
No shard.yml has been indexed for 0.0.1. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
SingleTon
Implementation of Singleton design patter for Crystal-lang.
Installation
Add this to your application's shard.yml:
dependencies:
singleton:
github: tbrand/crystal-singleton
Usage
require "singleton"
class Test < SingleTon
st_fields(
{st_type: :property, name: prop1, type: String, df: "text"},
{st_type: :getter, name: prop2, type: Int32, df: 0},
{st_type: :setter, name: prop3, type: Float64, df: 1.0}
)
def set_prop2(@prop2)
end
def get_prop3
@prop3
end
end
describe Singleton do
it "works" do
test = Test.get_instance
Test.get_instance.prop1.should eq("text")
Test.get_instance.prop2.should eq(0)
Test.get_instance.get_prop3.should eq(1.0)
test.prop1 = "ok"
test.set_prop2(100)
test.prop3 = 2.0
Test.get_instance.prop1.should eq("ok")
Test.get_instance.prop2.should eq(100)
Test.get_instance.get_prop3.should eq(2.0)
end
end
Note that parent class of each singleton is Single'T'on, not Single't'on
Development
TODO: Write development instructions here
Contributing
- Fork it ( https://github.com/tbrand/crystal-singleton/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- tbrand Taichiro Suzuki - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.0.1- Tagged
- Nov 29, 2016
- Commit
7eee3a85906f- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/topaz-crystal/crystal-singleton
Metadata
- Created
- Aug 16, 2026
- Updated
- Aug 16, 2026
- Synced
- Aug 16, 2026
- Versions
- 3