module Analytics module Serializer class Swift < Base class Logger def initialize(src) @src = src end def save(path) @file_name = 'AnalyticsLogger.swift' output_path = File.join(path, @file_name) File.write(output_path, render) end private def render ERB.new(template, nil, '-').result(binding) end def template <<~TEMPLATE <%= ERB.new(Analytics::Templates.tmpl_at('header.erb')).result(binding) %> import Foundation protocol AnalyticsLogger { func set(enabled: Bool) func log(event: Analytics.Event) func track(screen: Analytics.Screen) func set(userProperty: Analytics.UserProperty) } TEMPLATE end end end end end