Sha256: c549d169ee981f829223209a21a86c79ef83dce451a723305680c6912c7f9cca

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

class Livetext::Handler::Import
  include Helpers

  attr_reader :file

  def initialize(name)
    @name = name
    @file = find_file(name)
  end

  def self.get_module(name)
    handler = self.new(name)
    const1 = Object.constants
    @file = handler.file.sub(/.rb$/, "")
    require @file   # + ".rb"
    const2 = Object.constants
    names = (const2 - const1)
    abort "Expected ONE new constant: #{names.inspect}" if names.size != 1
    modname = names.first.to_s
    newmod = Object.const_get("::" + modname)
    newmod   # return actual module
  end

  private

  def cwd_root?
    File.dirname(File.expand_path(".")) == "/"
  end

  def fname2module(name)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
livetext-0.9.22 lib/handler/import.rb