class NHKore::Dict
@author Jonathan Bradley Whited @since 0.2.0
Attributes
entries[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/nhkore/dict.rb, line 24 def initialize super() @entries = {} end
scrape(hash,missingno: nil,url: nil)
click to toggle source
# File lib/nhkore/dict.rb, line 38 def self.scrape(hash,missingno: nil,url: nil) dict = Dict.new hash.each do |id,array| entry = Entry.scrape(id,array,missingno: missingno,url: url) next if entry.nil? raise ScrapeError,"duplicate ID[#{id}] at URL[#{url}] in hash[#{hash}]" if dict.key?(id) dict[id] = entry end return dict end
Public Instance Methods
[](id)
click to toggle source
# File lib/nhkore/dict.rb, line 30 def [](id) return @entries[id] end
[]=(id,entry)
click to toggle source
# File lib/nhkore/dict.rb, line 34 def []=(id,entry) @entries[id] = entry end
key?(id)
click to toggle source
# File lib/nhkore/dict.rb, line 53 def key?(id) return @entries.key?(id) end
to_s()
click to toggle source
# File lib/nhkore/dict.rb, line 57 def to_s s = ''.dup @entries.each do |id,entry| s << "#{id}:\n" s << " #{entry.to_s.gsub("\n","\n ").rstrip}\n" end return s end