Module: Zidian

Defined in:
lib/zidian.rb

Defined Under Namespace

Classes: InvalFindInputException, InvalidIdException, Word

Class Method Summary collapse

Class Method Details

.find(expression) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/zidian.rb', line 3

def self.find(expression)
  $KCODE = 'UTF8'
  case expression.class.name
  when "Array"
    expression.collect{|e| find(e) }.flatten.uniq
  when "Integer", "Fixnum" then
    Word.new(get_line(expression), expression)
  when "String" then
    find_word(expression).lines.to_a.collect{|line| Word.new(line) }
  else
    raise InvalFindInputException
  end
end