Module: Ciyuan

Defined in:
lib/ciyuan.rb,
lib/ciyuan/character.rb

Defined Under Namespace

Classes: Character

Constant Summary collapse

BASE_URL =
"http://www.internationalscientific.org/"
ETHY_PATH =
"CharacterEtymology.aspx?characterInput="

Class Method Summary collapse

Class Method Details

.search(character) ⇒ Object



12
13
14
15
16
17
# File 'lib/ciyuan.rb', line 12

def search(character)
  html = open("#{BASE_URL}#{ETHY_PATH}#{CGI::escape(character)}")
  doc = Nokogiri::HTML(html.read)
  doc.encoding = 'utf-8'
  Character.new(doc)
end