whatlanguage icon indicating copy to clipboard operation
whatlanguage copied to clipboard

NoMethodError: undefined method `language_iso' for "This is a test":String

Open davidesantangelo opened this issue 10 years ago • 4 comments

When i try this "This is a test".language_iso # => :en i got this NoMethodError: undefined method `language_iso' for "This is a test":String

davidesantangelo avatar Aug 19 '15 09:08 davidesantangelo

Ah, I think the version that includes that hasn't been gemified yet - the latest version on rubygems.org is older than the head version here. You can specify this repo in your Gemfile if you want to resolve this immediately, however.

peterc avatar Aug 19 '15 10:08 peterc

Not sure if I'm having the same or a different issue - I did install from the GitHub repo and can't execute any of the examples using String. require 'whatlanguage' returns true and WhatLanguage.new(:all) returns an object, but String.language simply doesn't exist...?

sixtyfive avatar Mar 15 '16 00:03 sixtyfive

Steps to reproduce

require 'whatlanguage'
# => true

"".language
# NoMethodError: undefined method `language' for "":String

require 'whatlanguage/string'
# => true

"".language
# => nil

Related PR: https://github.com/peterc/whatlanguage/pull/31

Deradon avatar Jun 06 '16 13:06 Deradon

Experimented a bit on Windows7 , 2.2.4p230, and after adding as suggested earlier gem 'whatlanguage', github: 'peterc/whatlanguage' to Gemfile (gets this one installed) and

require 'whatlanguage/string' to dsl.rb

and finally the language method is found.

TuulaP avatar Jun 27 '16 06:06 TuulaP