class Opensubtitles::Language
Attributes
name[R]
to_iso639_1[R]
to_iso639_2b[R]
to_locale[R]
Public Class Methods
from_iso639_2b(code)
click to toggle source
# File lib/opensubtitles/language.rb, line 67 def from_iso639_2b(code) new(LANGUAGES.find{ |lang| lang[:iso639_2b] == code }) end
from_locale(locale)
click to toggle source
# File lib/opensubtitles/language.rb, line 60 def from_locale(locale) locale = locale.split('.').first lang = LANGUAGES.find{ |lang| lang[:locale] == locale } return from_locale(locale.split('_').first) if !lang && locale.include?('_') new(lang) end
new(hash)
click to toggle source
# File lib/opensubtitles/language.rb, line 75 def initialize(hash) @name = hash[:name] @to_iso639_1 = hash[:iso639_1] @to_iso639_2b = hash[:iso639_2b] @to_locale = hash[:locale] end