Sha256: bc1e314e142d47b6b899f270cee437b41af257c3f99aa3aafbe4126bf3a53385

Contents?: true

Size: 385 Bytes

Versions: 24

Compression:

Stored size: 385 Bytes

Contents

# frozen_string_literal: true
module Hako
  class Loader
    def initialize(base_module, base_path)
      @base_module = base_module
      @base_path = base_path
    end

    def load(name)
      require "#{@base_path}/#{name}"
      @base_module.const_get(camelize(name))
    end

    private

    def camelize(name)
      name.split('_').map(&:capitalize).join('')
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hako-0.13.3 lib/hako/loader.rb
hako-0.13.2 lib/hako/loader.rb
hako-0.13.1 lib/hako/loader.rb
hako-0.13.0 lib/hako/loader.rb
hako-0.12.0 lib/hako/loader.rb
hako-0.11.2 lib/hako/loader.rb
hako-0.11.1 lib/hako/loader.rb
hako-0.11.0 lib/hako/loader.rb
hako-0.10.0 lib/hako/loader.rb
hako-0.9.4 lib/hako/loader.rb
hako-0.9.3 lib/hako/loader.rb
hako-0.9.2 lib/hako/loader.rb
hako-0.9.1 lib/hako/loader.rb
hako-0.9.0 lib/hako/loader.rb
hako-0.8.5 lib/hako/loader.rb
hako-0.8.4 lib/hako/loader.rb
hako-0.8.3 lib/hako/loader.rb
hako-0.8.2 lib/hako/loader.rb
hako-0.8.1 lib/hako/loader.rb
hako-0.8.0 lib/hako/loader.rb