Sha256: eb94ed52ac20005300ea0662e48fc94f1ad8347d7b0be8ed5453f250cc3fa372

Contents?: true

Size: 763 Bytes

Versions: 16

Compression:

Stored size: 763 Bytes

Contents

require 'json'
require "zengin_code/version"
require 'zengin_code/bank'
require 'zengin_code/branch'

module ZenginCode
  class << self
    def preload!
      banks = JSON.load(File.read(DATA_DIR.join('banks.json')))

      banks.values.each do |bank|
        ZenginCode::Bank.new(bank['code'], bank['name'], bank['kana'], bank['hira'], bank['roma'])
      end

      ZenginCode::Bank.all.each_pair do |code, bank|
        branches = JSON.load(File.read(DATA_DIR.join("branches/#{code}.json")))

        branches.values.each do |branch|
          branch = ZenginCode::Branch.new(bank, branch['code'], branch['name'], branch['kana'], branch['hira'], branch['roma'])
          bank.branches[branch.code] = branch
        end
      end
    end
  end

  preload!
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zengin_code-0.0.4.20151217 lib/zengin_code.rb
zengin_code-0.0.4.20150928 lib/zengin_code.rb
zengin_code-0.0.4.20150827 lib/zengin_code.rb
zengin_code-0.0.4.20150715 lib/zengin_code.rb
zengin_code-0.0.3.20150715 lib/zengin_code.rb
zengin_code-0.0.3.20150605 lib/zengin_code.rb
zengin_code-0.0.3.20150501 lib/zengin_code.rb
zengin_code-0.0.3.20150423 lib/zengin_code.rb
zengin_code-0.0.3.20150318 lib/zengin_code.rb
zengin_code-0.0.3.20150216 lib/zengin_code.rb
zengin_code-0.0.3.20150113 lib/zengin_code.rb
zengin_code-0.0.3.20150106 lib/zengin_code.rb
zengin_code-0.0.3.20141229 lib/zengin_code.rb
zengin_code-0.0.3.20141218 lib/zengin_code.rb
zengin_code-0.0.2.20141218 lib/zengin_code.rb
zengin_code-0.0.1.20141218 lib/zengin_code.rb