Class Jmdict::ImportListener
In: lib/jmdict/import_listener.rb
Parent: Object

Methods

clear_records   done?   full?   increment_by   new   records   reset  

Included Modules

Jmdict::Message

Public Class methods

[Source]

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

[Source]

    # File lib/jmdict/import_listener.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     = '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:     # run-time states and objects
23:     @_current_tag   = nil
24:     @_entities      = Hash.new
25:     @_number_parsed = 0
26:     @_skip_entry    = done?
27:   end

Public Instance methods

[Source]

    # File lib/jmdict/import_listener.rb, line 33
33:   def clear_records
34:     @records.clear
35:   end

[Source]

    # File lib/jmdict/import_listener.rb, line 37
37:   def done?
38:     @maximum_parsed ? @_number_parsed >= @maximum_parsed : false
39:   end

[Source]

    # File lib/jmdict/import_listener.rb, line 41
41:   def full?
42:     @increment_by ? @records.size >= @increment_by : false
43:   end

[Source]

    # File lib/jmdict/import_listener.rb, line 29
29:   def records
30:     @records
31:   end

Protected Instance methods

[Source]

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

[Validate]