CrgScoreboardExtractor
Extract data from the Carolina Roller Derby Scoreboard so it can be processed.
Installation
Add this line to your application's Gemfile:
gem 'crg-scoreboard-extractor'And then execute:
$ bundle
Or install it yourself as:
$ gem install crg-scoreboard-extractor
Usage
You can use the Watcher class to keep polling the xml file generated by the crg-scoreboard application:
CrgScoreboardExtractor::Watcher.new('path/to/scoreboard-0-now.xml').every(5) do |bout|
bout.period.time
bout.period.number
bout.period.running
bout.jam.time
bout.jam.number
bout.jam.running
bout.team1.name # There's also a Bout#team2 method
bout.team1.logo_path
bout.team1.score
bout.team1.lead_jammer
bout.team1.positions # The list of skaters positions in the current jam
bout.team1.jammer # A helper method to get the team's jammer in the current jam from the positions list
position = bout.team1.positions.first
position.type # Jammer, Pivot, Blocker1, Blocker2, etc.
position.name
position.number
endYou can also instantiate directly the Bout class:
CrgScoreboardExtractor::Bout.new(File.open('path/to/scoreboard-0-now.xml'))Development
After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.
To 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 to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Contributing
- Fork it ( https://github.com/[my-github-username]/crg-scoreboard-extractor/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request