Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
This Ruby gem contains a pre-created library for factoring baseball statistics.
Gem is still in development with more stats to be added.
Note: This project is in no way taking credit for creating any of the included baseball stats. This is a library created strictly to be used for easily figuring the included statistics based on the data received by the user.
Add this line to your application's Gemfile:
gem 'baseball'
And then execute:
$ bundle
Or install it yourself as:
$ gem install baseball
All methods in Baseball
take a hash as an argument. The hash should contain all the
key-value pairs needed for the specific method called.
Example hash:
your_player_hash = {
at_bats: 420,
hits: 134,
walks: 68,
hbp: 1,
sac_flies: 3,
singles: 77,
doubles: 27,
triples: 1,
hr: 29
}
Example uses:
Baseball.batting_average(your_player_hash)
# will return value of ".319"
Baseball.obp(your_player_hash)
# will return value of ".413"
Baseball.slg(your_player_hash)
# will return a value of ".595"
Baseball.ops(your_player_hash)
# will return a value of "1.008"
All values are returned as a string
Libary includes pitching, fielding, running, and batting stats. See tests for full hash key-values needed. (More detailed documentation will be added shortly)
include a hash with all the key-value pairs desired for each individual statistic into Baseball.compile()
The result is an object with all statistics based off of the hash passed as the argument. You can then call each method in the object.
example:
your_player_hash = {
at_bats: 420,
hits: 134,
walks: 68,
hbp: 1,
sac_flies: 3,
singles: 77,
doubles: 27,
triples: 1,
hr: 29
}
player = Baseball.compile(your_player_hash)
player.batting_average # => ".319"
player.obp # => ".413"
player.ops # => "1.008"
notes:
each specific stats' required values must be passed, or you will not receive the correct result. For instance, if you try to get batting statistics, but only entered pitching values into your hash you will not receive correct results.
since pitchers and batters share some stats (hits, walks) you will want to create two separate object records (one for batting, one for pitching) for pitchers that bat.
After checking out the repo, run bin/setup
to install dependencies. You can also 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
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/buzzamus/baseball.
Ruby programmers that are also very familiar with baseball statistics especially welcome.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that baseball demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.