Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/contexts/behaviour/SearchDictionary.rb | 45 | 33 | 62.22%
|
51.52%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 module JLDrill::Behaviour |
2 # Provides the ability to search the kanji and JEDictionary. |
3 module SearchDictionary |
4 |
5 # Returns true if the Kanji dictionary is loaded |
6 def kanjiLoaded? |
7 !@parent.kanji.nil? |
8 end |
9 |
10 # Returns the information for a given kanji character |
11 def kanjiInfo(character) |
12 retVal = "" |
13 kanji = @parent.kanji.kanjiList.findChar(character) |
14 if !kanji.nil? |
15 retVal = kanji.withRadical_to_s(@parent.radicals.radicalList) |
16 else |
17 kana = @parent.kana.kanaList.findChar(character) |
18 if !kana.nil? |
19 retVal = kana.to_s |
20 end |
21 end |
22 retVal |
23 end |
24 |
25 # Returns true if the dictionary is loaded |
26 def dictionaryLoaded? |
27 @parent.reference.loaded? |
28 end |
29 |
30 # Searches the dictionary for possible words in the string. |
31 # Attempts to deinflect the word and provide matches. |
32 # Returns an array of JWords. |
33 def search(string) |
34 matches = @parent.deinflect.match(string) |
35 retVal = matches.collect do |match| |
36 @parent.reference.findWord(match.last.dictionary) |
37 end.flatten |
38 |
39 retVal += @parent.reference.findWordsThatStart(string) |
40 return retVal.sort do |x,y| |
41 y.relevance <=> x.relevance |
42 end |
43 end |
44 end |
45 end |
Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8