Ruby wrapper gem for node-gamedig.
Providing support to use the node cli or running a tiny webservice for faster responses.
NodeJS or a compatible alternative is installed.
Then install the gamedig package with your favourite package manager globally, e.g. here with npm or yarn:
yarn global add gamedig
npm install -g gamedig
Add this line to your application's Gemfile:
gem 'game_dig'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install game_dig
You can use the basic cli wrapper or the tiny webservice instance.
This will just run the gamedig cli and return its result.
require 'game_dig'
data = GameDig.query(type: 'minecraft', host: 'my-server.example.com')
p data
Only the following parameters are implemented for the service wrapper: type, host, protocol
(version 0.1.0)
Behaves the same to the user, but runs a tiny node webservice in the background to avoid startup times when called more than one time.
your-ruby-app
--------> ruby-game_dig
--------> tiny node instance in a separate thread using gamedig node module
<----------------
It needs only about half of the query time, but might be not as stable as it involves much more complexity. (about 10ms vs 20ms)
require 'game_dig/service'
data = GameDig.query(type: 'minecraft', host: 'my-server.example.com')
p data
Check out the doc at RubyDoc:
https://www.rubydoc.info/gems/game_dig
As this library is only a wrapper, checkout the original node-gamedig documentation:
https://github.com/gamedig/node-gamedig
Bug reports and pull requests are welcome on GitHub at https://github.com/magynhard/ruby-game_dig.
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
ruby gamedig game-dig game_dig