class Stylegen::Generator

Public Class Methods

new(data) click to toggle source
# File lib/stylegen/generator.rb, line 8
def initialize(data)
  @data = Data.new(data)
end

Public Instance Methods

generate() click to toggle source
# File lib/stylegen/generator.rb, line 12
def generate
  template_content = File.read(File.join(__dir__, "resources/template.swift.erb"))
  template = Template.new(template_content, @data)

  file = File.open(@data.output_path, "w")
  file << template.render
  file.close
end
stats() click to toggle source
# File lib/stylegen/generator.rb, line 21
def stats
  @stats ||= { output_path: @data.output_path, color_count: @data.colors.count }
end