Sha256: 92713f3443d508b72f37f22e323c8e7776d4f9136c1b044f1bc3628b8326b5c7
Contents?: true
Size: 829 Bytes
Versions: 1
Compression:
Stored size: 829 Bytes
Contents
module Google module Translate # Extends String to add to_* and *_to_* module StringMixin def method_missing(method, *args) if method.to_s[/^((?:\w+)?to_\w+)$/] Google::Tr.send($1.to_sym, self) else super end end end # Extends array to add to_* and *_to_* module ArrayMixin def method_missing(method, *args) if method.to_s[/^((?:\w+)?to_\w+)$/] self.map do |element| if element.is_a?(Array) element.send($1) else Google::Tr.send($1.downcase.to_sym, element) end end else super end end end end end String.send(:include, Google::Translate::StringMixin) Array.send(:include, Google::Translate::ArrayMixin)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caius-gtranslate-0.9.1 | lib/gtranslate/mixins.rb |