Sha256: 27b9a06f4884b864b5f8051ad0577dee3d1ceb77d4c02455c6c1905945b9740e

Contents?: true

Size: 350 Bytes

Versions: 2

Compression:

Stored size: 350 Bytes

Contents

module MVCLI
  class Loader
    def initialize(path)
      @path = path
    end

    def load(type, name)
      pathname = "#{name}_#{type}"
      filename = File.join(@path, "app/#{type}s", pathname)
      require filename
      classname = pathname.capitalize.gsub(/_(\w)/) {|m| m[1].upcase}
      Object.const_get(classname).new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mvcli-0.0.3 lib/mvcli/loader.rb
mvcli-0.0.2 lib/mvcli/loader.rb