Sha256: 83e967b5053fedecd22ed5e2da25449fb79f9a7d39f35eb72ea8de4902e4fc29

Contents?: true

Size: 355 Bytes

Versions: 5

Compression:

Stored size: 355 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
hako-0.7.0 lib/hako/loader.rb
hako-0.6.1 lib/hako/loader.rb
hako-0.6.0 lib/hako/loader.rb
hako-0.5.1 lib/hako/loader.rb
hako-0.5.0 lib/hako/loader.rb