Sha256: e64f07d37d10647aec0b6d59105c6bfcf09d3d022e22cedba38c472686b4c66e

Contents?: true

Size: 680 Bytes

Versions: 4

Compression:

Stored size: 680 Bytes

Contents

class Livetext::Handler::ICanHaz
  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

4 entries across 4 versions & 1 rubygems

Version Path
livetext-0.9.21 lib/handler/icanhaz.rb
livetext-0.9.20 lib/handler/icanhaz.rb
livetext-0.9.19 lib/handler/icanhaz.rb
livetext-0.9.17 lib/handler/icanhaz.rb