makimoto / romaji

Romaji-Kana transliterator
96 stars 18 forks source link

undefined method `normalize' for Romaji:Module #12

Closed funatsufumiya closed 7 years ago

funatsufumiya commented 7 years ago

I tried using this library like below.

require "romaji/core_ext/string"

puts "tesuto".kana

but it raised undefined method 'normalize' for Romaji:Module (NoMethodError).

/user/.anyenv/envs/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/romaji-0.2.3/lib/romaji/string_extension.rb:6:in `normalize': undefined method `normalize' for Romaji:Module (NoMethodError)
    from /user/.anyenv/envs/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/romaji-0.2.3/lib/romaji/string_extension.rb:14:in `kana'
    from sample.rb:3:in `<main>'

The installation directory and the version of my ruby are below.

$ which ruby
/user/.anyenv/envs/rbenv/shims/ruby

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
makimoto commented 7 years ago

Thank you for your reporting.

romaji/core_ext/string is presupposed that romaji is required. So your code may work with adding require "romaji".

I'll look into omitting require "romaji"on using only core_ext in future versions.

funatsufumiya commented 7 years ago

@makimoto Adding require "romaji" before all, it worked! Thank you :)

require "romaji"
require "romaji/core_ext/string"

puts "tesuto".kana #=> テスト

My misreading of the README caused this trouble, sorry.