Giter VIP home page Giter VIP logo

faker_japanese's People

Contributors

denvazh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

trongthaonh

faker_japanese's Issues

"wrong number of arguments" error with stympy/faker v1.9.0+

Error Description

The gem seems incompatible with faker v1.9.0+. With the following versions defined in the Gemfile:

gem 'faker',          '1.9.1'
gem 'faker_japanese', '0.2.4'

loading the application fails with the following error:

/usr/local/rvm/gems/ruby-2.5.1/gems/bundler-1.16.3/lib/bundler/runtime.rb:84:in `rescue in block (2 levels) in require': There was an error while trying to load the
 gem 'faker_japanese'. (Bundler::GemRequireError)
Gem Load Error is: wrong number of arguments (given 1, expected 0)
Backtrace for gem load error is:
/usr/local/rvm/gems/ruby-2.5.1/gems/faker_japanese-0.2.4/lib/faker_japanese.rb:27:in `initialize'

Cause

This seems due to a new Faker::String class created in version 1.9.0 of faker:

faker-ruby/faker@v1.8.7...v1.9.0#diff-606ca7ead800c03c3025f08d2afca96d

And by chance, the Kanji class in the lib/faker_japanese.rb module inherits from String but within the Faker module. Therefore super in line 27 refers now to Faker::String instead of ruby's String.

# Kanji string
class Kanji < String
# @return [String] hiragana form
attr_reader :yomi
# @return [String] katakana form
attr_reader :kana
# @return [String] romanized form
attr_reader :romaji
# Create new Kanji string instance
# @param [String] kanji string in kanji from
# @param [String] yomi string with hiragana readings
# @param [String] kana string with katakana readings
# @param [String] romaji romanized string
def initialize(kanji, yomi, kana, romaji)
super(kanji)
@yomi = yomi
@kana = kana
@romaji = romaji
end
end

Solution

Refer to ruby's String class, e.g. by prefixing the class name with :::

+   class Kanji < ::String
-   class Kanji < String

in following line:

class Kanji < String

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.