#-- # wwwjdic # Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Marco Bresciani # # This file is part of wwwjdic. # # wwwjdic is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # wwwjdic is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License # along with wwwjdic. If not, see . #++ require_relative '../lib/wwwjdic' i = 0 # Creates the WWWJDic object puts '------------------------------------------' puts "Basics: '#{i}'. Creates the WWWJDic object." puts 'irb(main):001:0> a_wwwjdic = WWWJDic::breener' a_wwwjdic = WWWJDic::breener puts i += 1 # Translate '翻訳' in English, with default options puts '------------------------------------------' puts "Basics: '#{i}'. Translate '翻訳' in English, with default options." puts "irb(main):001:0> a_wwwjdic.translate '翻訳'" puts a_wwwjdic.translate '翻訳' puts i += 1 # Computes the default raw URI to translate '翻訳' in English # (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1ZUQ%E7%BF%BB%E8%A8%B3) puts '------------------------------------------' puts "Basics: '#{i}'. Computes the default raw URI to translate '翻訳' in English (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1ZUQ%E7%BF%BB%E8%A8%B3)." puts "irb(main):001:0> a_wwwjdic.raw_uri '翻訳'" puts a_wwwjdic.raw_uri '翻訳' puts i += 1 # Computes the default JSON URI to translate '翻訳' in English # ({"翻訳":"http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1MUQ%E7%BF%BB%E8%A8%B3"}) puts '------------------------------------------' puts "Basics: '#{i}'. Computes the default JSON URI to translate '翻訳' in English ({\"翻訳\":\"http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1MUQ%E7%BF%BB%E8%A8%B3\"})." puts "irb(main):001:0> a_wwwjdic.json_uri '翻訳'" puts a_wwwjdic.json_uri '翻訳' puts i += 1 # Computes the default basic URI to translate '翻訳' in Italian # (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?OMUQ%E7%BF%BB%E8%A8%B3) puts '------------------------------------------' puts "Basics: '#{i}'. Computes the default basic URI to translate '翻訳' in Italian (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?OMUQ%E7%BF%BB%E8%A8%B3)." puts "irb(main):001:0> a_wwwjdic.uri '翻訳', dict: 'Japanese-Italian'" puts a_wwwjdic.uri '翻訳', dict: 'Japanese-Italian' puts i += 1 # Computes the default JSON URI to translate '翻訳' in German # (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?GMUQ%E7%BF%BB%E8%A8%B3) puts '------------------------------------------' puts "Basics: '#{i}'. Computes the default basic URI to translate '翻訳' in German, through Monash university URI (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?GMUQ%E7%BF%BB%E8%A8%B3)." puts "irb(main):001:0> a_wwwjdic.uri '翻訳', dict: 'Japanese-German (WaDoku)', server: :monash" puts a_wwwjdic.uri '翻訳', dict: 'Japanese-German (WaDoku)', server: :monash puts i += 1 # Prints the current (default) WWWJDic configuration URL. # (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1M) puts '------------------------------------------' puts "Basics: '#{i}'. Prints the current (default) WWWJDic configuration URL (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1M)." puts 'irb(main):001:0> puts a_wwwjdic' puts a_wwwjdic puts i += 1 # Change the server value to Monash one. # () puts '------------------------------------------' puts "Basics: '#{i}'. Change the server value to Monash one." puts 'irb(main):001:0> a_wwwjdic.server = :monash' a_wwwjdic.server = :monash puts i += 1 # Prints the (currently set) server # (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?) puts '------------------------------------------' puts "Basics: '#{i}'. Prints the (currently set) server (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?)." puts 'irb(main):001:0> puts a_wwwjdic.server' puts a_wwwjdic.server puts i += 1 # Prints the WWWJDic configuration URL with currently set configuration. # (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1M) puts '------------------------------------------' puts "Basics: '#{i}'. Prints the WWWJDic configuration URL with currently set configuration (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1M)." puts 'irb(main):001:0> puts a_wwwjdic' puts a_wwwjdic puts i += 1 # Resets the configuration to default values. # (http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1M) puts '------------------------------------------' puts "Basics: '#{i}'. Resets the configuration to default values." puts 'irb(main):001:0> a_wwwjdic.reset' a_wwwjdic.reset puts i += 1 # Prints the current (default) WWWJDic configuration URL. # (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1M) puts '------------------------------------------' puts "Basics: '#{i}'. Prints the current (default) WWWJDic configuration URL (http://www.edrdg.org/cgi-bin/wwwjdic/wwwjdic.cgi?1M)." puts 'irb(main):001:0> puts a_wwwjdic' puts a_wwwjdic puts