No commit activity in last 3 years
No release in over 3 years
make to ruby error messages friendly. Display multilingual message and error lines
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0

Runtime

~> 0.8
~> 1.1
~> 2.5
 Project Readme

RubyFriendlyError ruby 2.4.5 ruby 2.5.3

Table of Contents
  • 1. Installation and Usage
  • 2. Samples
    • 2.1. miss spell
    • 2.2. miss args num
  • 3. Options
    • 3.1. RUBY_FRIENDLY_ERROR_LANG
  • 4. Development
  • 5. Contributing
  • 6. License
  • 7. Code of Conduct

Build Status

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

sample.rb
# 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

name_error_with_did_you_mean

2.2. miss args num

sample.rb
# 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

wrong_number_of_arguments_error

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

wrong_number_of_arguments_error_ja

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).