1. Installation and Usage
Add this line to your application’s Gemfile:
gem 'ruby_friendly_error'
$ bundle exec ruby_friendly_error your.rb
2. Samples
2.1. miss spell
# frozen_string_literal: true
def hoge prayer_life = 100 , player_lifee = 200
puts 'hoge' if player_life > 0
end
hoge
$ bundle exec ruby_friendly_error sample.rb
2.2. miss args num
# frozen_string_literal: true
def hoge arg1, arg2 = 'foobar'
puts arg1
puts arg2
end
hoge 'piyo', 'fuga', 'what!?'
$ bundle exec ruby_friendly_error sample.rb
3. Options
key | description | values | default |
---|---|---|---|
RUBY_FRIENDLY_ERROR_LANG |
message language. |
en, ja |
en |
RUBY_FRIENDLY_ERROR_WINDOW |
display error lines window size. |
Integer |
2 |
3.1. RUBY_FRIENDLY_ERROR_LANG
$ RUBY_FRIENDLY_ERROR_LANG=ja bundle exec ruby_friendly_error sample.rb
4. Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. 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.
5. Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/isuke/ruby_friendly_error. 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.
6. License
The gem is available as open source under the terms of the MIT License.
7. Code of Conduct
Everyone interacting in the RubyFriendlyError project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/isuke/ruby_friendly_error/blob/master/CODE_OF_CONDUCT.adoc).