Class: Biran::ERBConfig

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, name, extension, source, output) ⇒ ERBConfig

Returns a new instance of ERBConfig.



6
7
8
9
10
11
12
# File 'lib/biran/erb_config.rb', line 6

def initialize(config, name, extension, source, output)
  @name       = name
  @extension  = extension
  @config     = config
  @source_dir = source
  @output_dir = output
end

Instance Attribute Details

#bindingsObject

Returns the value of attribute bindings.



4
5
6
# File 'lib/biran/erb_config.rb', line 4

def bindings
  @bindings
end

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/biran/erb_config.rb', line 3

def config
  @config
end

#extensionObject (readonly)

Returns the value of attribute extension.



3
4
5
# File 'lib/biran/erb_config.rb', line 3

def extension
  @extension
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/biran/erb_config.rb', line 3

def name
  @name
end

#output_dirObject (readonly)

Returns the value of attribute output_dir.



3
4
5
# File 'lib/biran/erb_config.rb', line 3

def output_dir
  @output_dir
end

#source_dirObject (readonly)

Returns the value of attribute source_dir.



3
4
5
# File 'lib/biran/erb_config.rb', line 3

def source_dir
  @source_dir
end

Instance Method Details

#save!Object



14
15
16
17
18
# File 'lib/biran/erb_config.rb', line 14

def save!
  File.open(File.join(output_dir, "#{name}#{extension}"), 'w') do |f|
    f.print process_erb.result(build_erb_env.call)
  end
end