{"id":17077781,"url":"https://github.com/torokmark/iamsure","last_synced_at":"2025-04-12T20:23:52.195Z","repository":{"id":56877174,"uuid":"268228229","full_name":"torokmark/iamsure","owner":"torokmark","description":":heavy_check_mark: IamSure is a flexible precondition checker","archived":false,"fork":false,"pushed_at":"2020-05-31T18:20:45.000Z","size":31,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T03:23:22.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://torokmark.github.io/iamsure/","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/torokmark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-31T07:10:53.000Z","updated_at":"2020-06-14T19:00:56.000Z","dependencies_parsed_at":"2022-08-20T22:00:34.029Z","dependency_job_id":null,"html_url":"https://github.com/torokmark/iamsure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torokmark%2Fiamsure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torokmark%2Fiamsure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torokmark%2Fiamsure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/torokmark%2Fiamsure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/torokmark","download_url":"https://codeload.github.com/torokmark/iamsure/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248626831,"owners_count":21135741,"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-14T12:16:48.695Z","updated_at":"2025-04-12T20:23:52.172Z","avatar_url":"https://github.com/torokmark.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n![Travis (.org)](https://img.shields.io/travis/torokmark/iamsure)\n![Coveralls github](https://img.shields.io/coveralls/github/torokmark/iamsure)\n![Gem](https://img.shields.io/gem/v/iamsure?color=%23)\n# Iamsure\n\nIamSure is a precondition checker by chaining conditions next one another.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'iamsure'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install iamsure\n\n## Usage\n\n```ruby\ndef fun(arg)\n  IamSure.of(arg)\n    .not_nil(\"argument cannot be null\")\n    .get # =\u003e arg\nend\n```\n\n```ruby\nclass CustomUnpacker \u003c Iamsure::Unpacker\n  def unpack(arg)\n    \"#{ arg }/some.rb\"\n  end\nend\n\nclass CustomInitiator \u003c Iamsure::Initiator\n  def init(arg)\n    arg.to_s\n  end\nend\n\ndef fun(arg)\n  IamSure.of(arg)\n    .not_nil('arg cannot be nil!')\n    .unpack(CustomUnpacker.new)\n    .not_empty(\"arg cannot be empty\")\n    .exist(as: :file)\n    .get(CustomInitiator.new) # =\u003e \nend\n```\n## Documentation\n\n`IamSure.of(arg): IamSure` creates new instance with the given argument.\n\n`IamSure#not_nil(msg): IamSure` check whether the value is not `nil`.\n\n`IamSure#not_empty(msg): IamSure` check whether the value is not empty.\n\n`IamSure#exist(as): IamSure` check whether the value is file (`as: :file`) or directory (`as: :dir`).\n\n`IamSure#unpack(unpacker): IamSure` transforms the value into a new one.\n\n`IamSure#get(initiator): object` returns the the checked object or its initiated value.\n\n\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/torokmark/iamsure. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Iamsure project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/torokmark/iamsure/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorokmark%2Fiamsure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftorokmark%2Fiamsure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftorokmark%2Fiamsure/lists"}