Class: Bgem::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bgem.rb

Defined Under Namespace

Classes: DSL, MacroDir

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_file) ⇒ Config

Returns a new instance of Config.



33
34
35
36
37
38
39
# File 'lib/bgem.rb', line 33

def initialize config_file
  @entry, @output, @scope = SOURCE_FILE, 'output.rb', nil
  DSL.new self, (IO.read config_file)

  @dir = Pathname File.dirname config_file
  define_macros
end

Instance Attribute Details

#entryObject

Returns the value of attribute entry.



32
33
34
# File 'lib/bgem.rb', line 32

def entry
  @entry
end

#outputObject

Returns the value of attribute output.



32
33
34
# File 'lib/bgem.rb', line 32

def output
  @output
end

#scopeObject

Returns the value of attribute scope.



32
33
34
# File 'lib/bgem.rb', line 32

def scope
  @scope
end

Instance Method Details

#define_macrosObject



41
42
43
44
45
46
47
48
# File 'lib/bgem.rb', line 41

def define_macros
  Output::Ext.file_extensions.map do |type|
    dir = @dir + type.to_s
    MacroDir.new(type, dir) if dir.directory?
  end.compact.each do |macro_dir|
    macro_dir.define_macros
  end
end