{"id":26430779,"url":"https://github.com/rukomoynikov/processable","last_synced_at":"2025-03-18T05:34:25.806Z","repository":{"id":45706592,"uuid":"514166242","full_name":"Rukomoynikov/processable","owner":"Rukomoynikov","description":"A handy way (I hope) to convert a service object like things to a series of steps","archived":false,"fork":false,"pushed_at":"2023-10-20T18:44:38.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-02T12:11:29.561Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":"","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/Rukomoynikov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-15T06:53:14.000Z","updated_at":"2022-07-22T06:50:25.000Z","dependencies_parsed_at":"2022-09-26T21:30:19.568Z","dependency_job_id":null,"html_url":"https://github.com/Rukomoynikov/processable","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/Rukomoynikov%2Fprocessable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rukomoynikov%2Fprocessable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rukomoynikov%2Fprocessable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rukomoynikov%2Fprocessable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rukomoynikov","download_url":"https://codeload.github.com/Rukomoynikov/processable/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244166366,"owners_count":20409165,"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":["ruby"],"created_at":"2025-03-18T05:34:25.237Z","updated_at":"2025-03-18T05:34:25.799Z","avatar_url":"https://github.com/Rukomoynikov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Processable\n\n\nRuby gem to help you organize any process into series of steps. \n\n```ruby\nclass PrintGithubRepos \u003c Processable\n  step :get_repos do\n    github_client.where('rails', per_page: 100)\n  end\n\n  step :get_only_essential_fields do |repos_json|\n    repos_json.except(:title, :description)\n  end\n  \n  step :print_to_console do |result_from_prev_step, current_step, list_of_steps|\n    print result_from_prev_step\n  end\nend\n\nPrintGithubRepos.new.process\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'processable'\n```\n\nAnd then execute:\n```shell\nbundle install\n```\n\nOr install it yourself as:\n```shell\ngem install processable\n```\n## Usage\n\n**Define new class with required behavior**\n\n```ruby\nclass SiteScrapper \u003c Processable\nend\n```\n\n**Add steps to the process**\n\nEach step accepts three optional paramaters: [result from_previous step, current_step, all_steps]. Each step has some result as we usually do it you can either call return explicitly or last line will be accepted as result of the step. \n\n```ruby\nrequire 'net/http'\n\nclass SiteScrapper \u003c Processable\n  step :get_web_pages do\n    Net::HTTP.get('example.com', '/index.html')    \n  end\n  \n  step :save_to_database do |web_page|\n    DB.save(web_page)\n  end\nend\n```\n\n**Trigger the process**\n\nTo start the process simply call... \n\n```ruby\nSiteScrapper.new.process\n```\n\nTo run the process until some certain step you can pass the name of the step as an argument. Also keep in mind the step defined in run_until will not be executed as well.\n\n```ruby\nSiteScrapper.new.process(run_until: :save_to_database)\n```\n\nTo exec only one particular step you can pass the name of the step as an argument. \n\n```ruby\nSiteScrapper.new.process(exec_step: :save_to_database)\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 the created tag, 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/Rukomoynikov/processable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Rukomoynikov/processable/blob/master/CODE_OF_CONDUCT.md).\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 Processable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Rukomoynikov/processable/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukomoynikov%2Fprocessable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frukomoynikov%2Fprocessable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukomoynikov%2Fprocessable/lists"}