Class Jmdict::ImportReader
In: lib/jmdict/import_reader.rb
Parent: Object

Methods

clear_records   done?   full?   increment_by   is_comment?   new   records   reset  

Included Modules

Jmdict::Message

Public Class methods

[Source]

   # File lib/jmdict/import_reader.rb, line 7
7:   def self.increment_by(increment_by)
8:     @increment_by = increment_by
9:   end

[Source]

    # File lib/jmdict/import_reader.rb, line 11
11:   def initialize(filename, version, maximum_parsed = nil)
12:     @filename               = filename
13:     @maximum_parsed         = maximum_parsed ? maximum_parsed.to_i : maximum_parsed
14:     @records                = Array.new
15:     @japanese_language      = Language.get_japanese
16:     @source_description     = 'krad version [' + version + '] imported on ' + DateTime.now.to_s
17:     @increment_by           = @maximum_parsed ? @maximum_parsed / 10 : @increment_by ? @increment_by / 10 : 250
18:     @increment_by           = @increment_by <= 0 ? 1 : @increment_by
19:     @message_every_nth_time = @increment_by / 10
20:     @message_every_nth_time = @message_every_nth_time <= 0 ? 1 : @message_every_nth_time
21: 
22:     @_number_parsed = 0
23:     @_skip_entry    = done?
24:   end

Public Instance methods

[Source]

    # File lib/jmdict/import_reader.rb, line 30
30:   def clear_records
31:     @records.clear
32:   end

[Source]

    # File lib/jmdict/import_reader.rb, line 34
34:   def done?
35:     @maximum_parsed ? @_number_parsed >= @maximum_parsed : false
36:   end

[Source]

    # File lib/jmdict/import_reader.rb, line 38
38:   def full?
39:     @increment_by ? @records.size >= @increment_by : false
40:   end

[Source]

    # File lib/jmdict/import_reader.rb, line 42
42:   def is_comment?(line)
43:     false
44:   end

[Source]

    # File lib/jmdict/import_reader.rb, line 26
26:   def records
27:     @records
28:   end

Protected Instance methods

[Source]

    # File lib/jmdict/import_reader.rb, line 48
48:   def reset
49:     @_skip_entry              = done?
50:   end

[Validate]