Class: WWWJDic::Parsers::Search
- Inherits:
-
Object
- Object
- WWWJDic::Parsers::Search
- Defined in:
- lib/wwwjdic/parsers/search.rb
Overview
This class is an implementation of the Parsable duck type that checks the display type. The only needed parameter is the word to translate.
t is the search type:
-
for dictionary lookups use:
-
D where the lookup text is in ASCII, EUC, ISO-2022-JP or UCS
-
(the old uxxxx format);
* S where the lookup text is in Shift-JIS;
* U where the lookup text is in UTF-8.
-
for kanji lookups use:
-
K for all lookups via codes, codepoints, etc. or where the
-
text string (e.g. kanji or reading) is in EUC;
* M for all lookups using a text string in UTF8;
* N for all lookups using a text string in Shift_JIS;
-
for text glossing/translate words in text use:
-
G where the text is in EUC, ISO-2022-JP or UCS;
-
H where the text is in Shift-JIS;
-
I where the text is in UTF-8.
-
-
for multi-radical kanji lookups use:
-
B where the text is in EUC, ISO-2022-JP or UCS;
-
C where the text is in Shift-JIS;
-
F where the text is in UTF-8.
-
-
for example sentence lookups via indexed Japanese words, use E.
-
for example sentence lookups using a regular expression, use T.
- Author
- Copyright
-
Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
- License
-
GNU General Public License version 3
Instance Method Summary collapse
-
#parse(value = '') ⇒ Object
The parsable duck type interface to every parser usage.
Instance Method Details
#parse(value = '') ⇒ Object
The parsable duck type interface to every parser usage.
54 55 56 57 |
# File 'lib/wwwjdic/parsers/search.rb', line 54 def parse(value = '') return 'D' if value == CGI::escape(value).to_s 'U' end |