Class: Makimono::Generator::SimpleFile

Inherits:
Object
  • Object
show all
Defined in:
lib/makimono/generator/simple_file.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ SimpleFile

Returns a new instance of SimpleFile.



6
7
8
# File 'lib/makimono/generator/simple_file.rb', line 6

def initialize(config)
  @config = config
end

Instance Method Details

#generate(resources) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/makimono/generator/simple_file.rb', line 10

def generate(resources)
  FileUtils.mkdir_p(@config[:output]) unless Dir.exist?(@config[:output])

  resources.each do |resource|
    output_path = File.expand_path(resource.path, @config[:output])
    File.write(output_path, resource.content)
  end
end