Sha256: 8a1e7df6b428cc0e90e46726220d0102a1c2202860815c81d4c1cdf5caad4d20
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
module Analytics module Serializer class Swift < Base class Screen def initialize(src) @src = src end def save(path) @file_name = 'AnalyticsScreen.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 extension Analytics { struct Screen { let name: String private init(name: String) { self.name = name } } } // MARK: - Screens extension Analytics.Screen { <% @src["screens"].each do |screen| -%> /// <%= screen["description"] %> static var <%= screen["name"].camel_case -%>: Analytics.Screen { return .init(name: "<%= screen["name"] -%>") } <% end -%> } 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/screen.rb |
ios_analytics_cli-1.0.0 | lib/ios_analytics_cli/serializers/swift/screen.rb |