Class: Lingua::Language

Inherits:
Object
  • Object
show all
Defined in:
lib/lingua/language.rb

Overview

Represents a language returned by Lingua detection and lookup APIs.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



12
13
14
15
16
17
18
19
# File 'lib/lingua/language.rb', line 12

def method_missing(method_name, *args)
  if method_name.end_with?('?') && args.empty?
    match = Lingua::Language[method_name.name.delete_suffix('?')]
    !match.nil? && self == match
  else
    super
  end
end