module Tagger class Generator attr_accessor :events, :platform def initialize(events, platform) @events = events @platform = platform end def generate(output_location) File.write("#{output_location}/#{output_file_name}", output) end private def template File.open(template_file, "r").read end def output_file_name case @platform when :ios "AnalyticsEvent.swift" when :android "AnalyticsEvent.kt" end end def template_file case @platform when :ios "lib/templates/AnalyticsEvent.swift.erb" when :android "lib/templates/AnalyticsEvent.kt.erb" end end def renderer ERB.new(template, nil, '-') end def output renderer.result(binding) end end end