{"id":13533056,"url":"https://github.com/rajasegar/ruby-ast-explorer","last_synced_at":"2025-05-07T00:40:47.616Z","repository":{"id":36166398,"uuid":"200955040","full_name":"rajasegar/ruby-ast-explorer","owner":"rajasegar","description":"AST Explorer for ruby","archived":false,"fork":false,"pushed_at":"2023-03-01T21:33:37.000Z","size":2907,"stargazers_count":16,"open_issues_count":26,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-25T19:43:11.391Z","etag":null,"topics":["abstract-syntax-tree","ast","ast-explorer","codemod","parser","ruby"],"latest_commit_sha":null,"homepage":"https://ruby-ast-explorer.herokuapp.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rajasegar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-07T02:13:32.000Z","updated_at":"2024-10-29T19:22:53.000Z","dependencies_parsed_at":"2024-10-23T12:44:43.597Z","dependency_job_id":null,"html_url":"https://github.com/rajasegar/ruby-ast-explorer","commit_stats":{"total_commits":82,"total_committers":3,"mean_commits":"27.333333333333332","dds":"0.46341463414634143","last_synced_commit":"e5c3a402bd1195248d0d2d7b97856c1fd286e0d3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajasegar%2Fruby-ast-explorer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajasegar%2Fruby-ast-explorer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajasegar%2Fruby-ast-explorer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rajasegar%2Fruby-ast-explorer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rajasegar","download_url":"https://codeload.github.com/rajasegar/ruby-ast-explorer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242868362,"owners_count":20198462,"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":["abstract-syntax-tree","ast","ast-explorer","codemod","parser","ruby"],"created_at":"2024-08-01T07:01:16.167Z","updated_at":"2025-03-10T14:31:50.638Z","avatar_url":"https://github.com/rajasegar.png","language":"JavaScript","funding_links":[],"categories":["Ruby","Tools"],"sub_categories":[],"readme":"# ruby-ast-explorer\n\nAST Explorer lets you to visualize your ruby code as AST(Abstract Syntax Trees). \n\nThis uses the [parser](https://github.com/whitequark/parser) gem to convert the source code into ASTs \nand the [TreeWriter](https://www.rubydoc.info/github/whitequark/parser/Parser/TreeRewriter) class\nof the gem to apply transformations on the AST nodes and convert them back to source code.\n\nWe can take the transformation logic and put into a ruby file like `transform.rb` and use \nthe same to do large scale refactorings with your ruby code base using tools like [codeshift](https://github.com/rajasegar/codeshift) and [cybertron](https://github.com/rajasegar/cybertron).\n\n```sh\n$ codeshift -t transform.rb app/models/**/*.rb\n```\n\n## Export as gist\nYou can also export the source and transform code as gist to your Github account by clicking\nthe `Export as gist` button. But before that you need to sign in with Github and give permission to create gists for this app named ruby-ast-explorer.\n\n\nAnd with that you can directly use the transform from your gist.\n```sh\n$ codeshift -t https://gist.githubusercontent.com/[user]/.../transform.rb  app/models/**/*.rb\n```\n\nIt has got four panes with the following content:\n\n* Top-Left =\u003e Original Source Code\n* Top-Right =\u003e AST in Tree and S-expressions formats\n* Bottom-Left =\u003e Transform Class\n* Bottom-Right =\u003e Output\n\n![screenshot](https://github.com/rajasegar/ruby-ast-explorer/blob/master/public/screenshot.png)\n\n\n## Reference:\n* https://whitequark.org/blog/2013/04/26/lets-play-with-ruby-code/\n* https://blog.arkency.com/using-ruby-parser-and-ast-tree-to-find-deprecated-syntax/\n* https://blog.arkency.com/rewriting-deprecated-apis-with-parser-gem/\n* https://gist.github.com/jonatas/e70c874cbbd0cac5a9abd9f4a78fa816\n* https://github.com/jonatas/fast\n* http://www.zenspider.com/projects/ruby2ruby.html\n* [Parsing Ruby](https://whitequark.org/blog/2012/10/02/parsing-ruby/)\n* [awesome-ruby-ast](https://github.com/rajasegar/awesome-ruby-ast)\n\nInspired by [AST Explorer](https://astexplorer.net) by [Felix Kling](https://github.com/fkling)\n\n## Tools\n* [parser gem](https://github.com/whitequark/parser)\n* [CodeMirror](https://codemirror.net/)\n\n## Other related tools\n* [Astrolabe](https://github.com/yujinakayama/astrolabe)\n* [codeshift](https://github.com/rajasegar/codeshift)\n* [cybertron](https://github.com/rajasegar/cybertron)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajasegar%2Fruby-ast-explorer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frajasegar%2Fruby-ast-explorer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frajasegar%2Fruby-ast-explorer/lists"}