{"id":20516387,"url":"https://github.com/eirc/spells","last_synced_at":"2025-04-14T00:36:23.257Z","repository":{"id":15683634,"uuid":"18421287","full_name":"eirc/spells","owner":"eirc","description":"Spells is a library for parsing the text on Magic the Gathering cards","archived":false,"fork":false,"pushed_at":"2014-04-08T19:55:24.000Z","size":249,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T14:51:57.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/eirc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-03T23:18:23.000Z","updated_at":"2020-09-15T07:09:18.000Z","dependencies_parsed_at":"2022-09-24T03:33:52.160Z","dependency_job_id":null,"html_url":"https://github.com/eirc/spells","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/eirc%2Fspells","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eirc%2Fspells/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eirc%2Fspells/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eirc%2Fspells/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eirc","download_url":"https://codeload.github.com/eirc/spells/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358555,"owners_count":21090402,"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-15T21:28:35.894Z","updated_at":"2025-04-14T00:36:23.228Z","avatar_url":"https://github.com/eirc.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spells\n\n[![Gem Version](https://badge.fury.io/rb/spells.png)](http://badge.fury.io/rb/spells)\n[![Build Status](https://travis-ci.org/eirc/spells.svg?branch=master)](https://travis-ci.org/eirc/spells)\n[![Code Climate](https://codeclimate.com/github/eirc/spells.png)](https://codeclimate.com/github/eirc/spells)\n[![PullReview stats](https://www.pullreview.com/github/eirc/spells/badges/master.svg?)](https://www.pullreview.com/github/eirc/spells/reviews/master)\n[![Dependencies Status](https://gemnasium.com/eirc/spells.png)](https://gemnasium.com/eirc/spells)\n[![Coverage Status](https://coveralls.io/repos/eirc/spells/badge.png)](https://coveralls.io/r/eirc/spells)\n\nSpells is a library for parsing the text on Magic: The Gathering cards.\n\nNote that this is pre-pre-Alpha software and you should probably not really use it!\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'spells'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install spells\n\n## Usage\n\nParsing activated abilities\n\n```ruby\ncard = Spells::Card.new\ncard.text = \"{2}{R}, {T}: Ghost-Lit Raider deals 2 damage to target creature.\nChannel - {3}{R}, Discard Ghost-Lit Raider: Ghost-Lit Raider deals 4 damage to target creature.\"\ncard.abilities.map \u0026:text_value\n# =\u003e [\"{2}{R}, {T}: Ghost-Lit Raider deals 2 damage to target creature.\", \"Channel - {3}{R}, Discard Ghost-Lit Raider: Ghost-Lit Raider deals 4 damage to target creature.\"]\ncard.triggered_abilities.map \u0026:text_value\n# =\u003e []\ncard.activated_abilities.map \u0026:text_value\n# =\u003e [\"{2}{R}, {T}: Ghost-Lit Raider deals 2 damage to target creature.\", \"Channel - {3}{R}, Discard Ghost-Lit Raider: Ghost-Lit Raider deals 4 damage to target creature.\"]\n```\n\nParsing triggered abilities\n\n```ruby\ncard = Spells::Card.new\ncard.text = \"Whenever Abomination blocks or becomes blocked by a green or white creature, destroy that creature at end of combat.\"\ncard.abilities.map \u0026:text_value\n# =\u003e [\"Whenever Abomination blocks or becomes blocked by a green or white creature, destroy that creature at end of combat.\"]\ncard.triggered_abilities.map \u0026:text_value\n# =\u003e [\"Whenever Abomination blocks or becomes blocked by a green or white creature, destroy that creature at end of combat.\"]\ncard.activated_abilities.map \u0026:text_value\n# =\u003e []\n```\n\n## Development\n\nThis gem uses the [treetop](http://treetop.rubyforge.org) gem for declaring the syntax tree. Some resources on treetop:\n\n* http://treetop.rubyforge.org\n* http://thingsaaronmade.com/blog/a-quick-intro-to-writing-a-parser-using-treetop.html\n\n## Resources\n\nOther open source or general resources related to Magic: The Gathering\n\n* https://github.com/ancestral/Verse\n* https://github.com/Zannick/demystify\n* http://www.goblinopera.com/mathemagics\n* http://wololo.net/2009/08/12/parsing-cards\n* https://code.google.com/p/laterna-magica\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/spells/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feirc%2Fspells","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feirc%2Fspells","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feirc%2Fspells/lists"}