Sha256: 3e45c32cd8ba2b52179be93c6e6222c77a367afbbeb1472d37554be1154b35a6

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ios_analytics_cli-1.1.0 lib/ios_analytics_cli/serializers/swift/logger.rb
ios_analytics_cli-1.0.0 lib/ios_analytics_cli/serializers/swift/logger.rb