Sha256: 8c99bf31ab56d9276c16b8a64a74356dad216fac5c73bd63f800a15576e859a1

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

require_relative '../helpers'  # FIXME This seems wrong

make_exception(:NoEqualSign,     "Error: no equal sign found")

class Livetext::ParseMixin
  include Livetext::Helpers

  def initialize(name)
    @name = name
    @file = find_file(name, ".rb", "plugin")
  end

  def self.get_module(name)
    parse = self.new(name)
    modname, code = parse.read_mixin
    eval(code)   # Avoid in the future
    newmod = Object.const_get("::" + modname)
    newmod   # return actual module
  end

  def read_mixin
    modname = @name.gsub("/","_").capitalize
    meths = grab_file(@file)
    [modname, "module ::#{modname}; #{meths}\nend"]
  end

  private

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
livetext-0.9.23 lib/parser/mixin.rb