Class: Stylegen::Generator

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

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Generator

Returns a new instance of Generator.



8
9
10
# File 'lib/stylegen/generator.rb', line 8

def initialize(data)
  @data = Data.new(data)
end

Instance Method Details

#generateObject



12
13
14
15
16
17
18
# File 'lib/stylegen/generator.rb', line 12

def generate
  template = Template.new(@data)

  file = File.open(@data.output_path, 'w')
  file << template.render
  file.close
end

#statsObject



20
21
22
# File 'lib/stylegen/generator.rb', line 20

def stats
  @stats ||= { output_path: @data.output_path, color_count: @data.color_entries.count }
end