{"id":21587932,"url":"https://github.com/jimweirich/sorcerer","last_synced_at":"2025-04-10T20:22:44.383Z","repository":{"id":735525,"uuid":"385504","full_name":"jimweirich/sorcerer","owner":"jimweirich","description":"Generate Ruby source from a Ripper style AST","archived":false,"fork":false,"pushed_at":"2019-04-16T08:43:09.000Z","size":324,"stargazers_count":98,"open_issues_count":5,"forks_count":11,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-24T18:03:39.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/jimweirich/sorcerer","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"golang-samples/channel","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimweirich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-11-25T17:48:54.000Z","updated_at":"2023-11-23T04:54:31.000Z","dependencies_parsed_at":"2022-07-05T13:13:31.776Z","dependency_job_id":null,"html_url":"https://github.com/jimweirich/sorcerer","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimweirich%2Fsorcerer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimweirich%2Fsorcerer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimweirich%2Fsorcerer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimweirich%2Fsorcerer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimweirich","download_url":"https://codeload.github.com/jimweirich/sorcerer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248289974,"owners_count":21078923,"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-11-24T15:18:05.689Z","updated_at":"2025-04-10T20:22:44.351Z","avatar_url":"https://github.com/jimweirich.png","language":"Ruby","funding_links":[],"categories":["Ruby ##"],"sub_categories":[],"readme":"# Sorcerer -- Recovering the Source\n\n| Master |\n| :----: |\n| [![Master Build Status](https://secure.travis-ci.org/jimweirich/sorcerer.png?branch=master)](https://secure.travis-ci.org/jimweirich/sorcerer) |\n\nSorcerer will generate Ruby code from a Ripper-like abstract syntax\ntree (i.e. S-Expressions).\n\nSorcerer is targetted mainly at small snippets of Ruby code,\nexpressable in a single line. Longer examples may be re-sourced, but\nthey will be rendered in a single line format.\n\n**Version: 1.0.0**\n\n## Limitations\n\nSorcerer is only tested on Ruby 1.9 and 2.0.\n\n## Links\n\n| Description            | Link |\n| :---:                  | :---: |\n| Documents              | http://github.com/jimweirich/sorcerer |\n| Git Clone              | git://github.com/jimweirich/sorcerer.git |\n| Issues / Bug Tracking  | https://github.com/jimweirich/sorcerer/issues |\n| Continuous Integration | http://travis-ci.org/#!/jimweirich/sorcerer |\n\n## Examples\n\n```ruby\n  sexp = [:binary,\n           [:var_ref, [:@ident, \"a\", [1, 0]]],\n           :+,\n           [:var_ref, [:@ident, \"b\", [1, 4]]]]\n  puts Sorcerer.source(sexp)\n```\n\nwill generate\n\n```ruby\n  a + b\n```\n\nRipper may be used to produce the s-expressions used by Sorcerer. The\nfollowing will produce the same output.\n\n```ruby\n  sexp = Ripper::SexpBuilder.new(\"a + b\").parse\n  puts Sorcerer.source(sexp)\n```\n\n## Options\n\n### No Options\n\nBy default, sorcerer will output its source in single line mode.\n\nFor example, given:\n\n```ruby\n  sexp = Ripper::SexpBuilder.new(\"def foo; bar; end\").parse\n```\n\nThen the following\n\n```ruby\n  puts Sorcerer.source(sexp)\n```\n\ngenerates single line output (the default):\n\n```ruby\ndef foo; bar; end\n```\n\n### Multi-Line Output\n\nIf you want multi-line output of source, add the multiline option to\nthe source command.\n\nFor example, given the sexp generated above, then this\n\n```ruby\n  puts Sorcerer.source(sexp, multiline: true)\n```\n\ngenerates multi-line output\n\n```ruby\ndef foo\nbar\nend\n```\n\n(Note that all multi-line output will have a final newline.)\n\n### Indentation\n\nBy default, sorcerer does not indent its multiline output.  Adding the\n\"indent\" option will cause the output to be indented.\n\nFor example, given the sexp generated above, then the following\n\n```ruby\n  puts Sorcerer.source(sexp, indent: true)\n```\n\ngenerates indented output:\n\n```ruby\ndef foo\n  bar\nend\n```\n\n### Debugging Output\n\nIf you wish to see the S-Expressions processed by Sorcerer and the\noutput emitted, then use the debug option:\n\n```ruby\n  puts Sorcerer.source(sexp, debug: true)\n```\n\n## License\n\nSorcerer is available under the terms of the MIT license. See the\nMIT-LICENSE file for details.\n\n## History\n\n* 1.0.2 - Fix bug in interpolated regular expression resourcing.\n\n* 1.0.1 - Add support for missing exception class or variable in\n          rescue (from Trent Ogren).\n\n* 1.0.0 - Ready for the work, version 1!\n\n* 0.3.11 - Fix support for subexpressions involving Meth() calls.\n\n* 0.3.10 - Fix several issues with spaces in argument lists.\n\n* 0.3.9 - Support %i{} and %I{}.\n\n* 0.3.8 - Include constants in sub-expressions.\n\n* 0.3.7 - Include array in sub-expressions.\n\n* 0.3.6 - Support 'defined?'. Suppress nil, true, false in\n          sub-expressions.\n\n* 0.3.5 - Add handler for mrhs_new.\n\n* 0.3.4 - Support 'meth a, b'.\n\n* 0.3.3 - Fix unary not.\n\n* 0.3.2 - Support 'def mod.method' syntax.\n\n* 0.3.1 - 1.9.3 support. Indenting stabby procs. RedCloth not required\n          for testing.\n\n* 0.3.0 - New hash literal support. Multi-line output always end with\n          a newline.\n\n* 0.2.0 - Added support for indented output.\n\n* 0.1.0 - Added support for multi-line output. Improved rendering of a\n          number of constructs\n\n* 0.0.7 - Basic single line version\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimweirich%2Fsorcerer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimweirich%2Fsorcerer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimweirich%2Fsorcerer/lists"}