lib/jldrill/model/items/Vocabulary.rb in jldrill-0.5.1.7 vs lib/jldrill/model/items/Vocabulary.rb in jldrill-0.6.0.1
- old
+ new
@@ -1,8 +1,8 @@
+# encoding: utf-8
require "jldrill/model/items/StringField"
require "jldrill/model/items/ListField"
-require "jldrill/model/items/ItemFactory"
# Class file for Japanese vocabulary
# Currently geared towards edict, but that might change
module JLDrill
@@ -14,12 +14,16 @@
READING_RE = /^Reading: (.*)/
DEFINITIONS_RE = /^Definitions: (.*)/
MARKERS_RE = /^Markers: (.*)/
QUOTE_RE = /["]/
RETURN_RE = /[\n]/
- TO_A_RE = Regexp.new("",nil,'U')
+ TO_A_RE = Regexp.new("",nil,'u')
+ Headings = [["kanji", "Kanji", 90],
+ ["reading", "Reading", 130],
+ ["definitions", "Meaning", 230]]
+
def initialize(kanji=nil, reading=nil, definitions=nil,
markers=nil, hint=nil, position=nil)
@kanji = StringField.new("Kanji", kanji)
@reading = StringField.new("Reading", reading)
@hint = StringField.new("Hint", hint)
@@ -36,14 +40,9 @@
# Returns a deep copy of this item. Note: Does *not* copy parameters
# that are not saveable. This is because of my cheezy implementation.
def clone
Vocabulary.create(self.to_s)
- end
-
- # Return the JLDrill ItemType for this item
- def itemType
- return ItemFactory::find(self.class)
end
# True if the two vocabulary are discussing the same word
# This does *not* compare the hint
# since it does not affect the meaning of the word.