Class: KCommercial::Resources::SwiftGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/KCommercialPipeline/core/resource/swift/swift_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keys, options = {}) ⇒ SwiftGenerator

Create a new SwiftGenerator

Parameters:

  • keys (Array<String>)

    the defines for keys



27
28
29
30
31
# File 'lib/KCommercialPipeline/core/resource/swift/swift_generator.rb', line 27

def initialize(keys, options = {})
  @keys = keys
  @keys ||= []
  @super_module = options.delete(:super) { :MKResources}
end

Instance Attribute Details

#keysArray<String> (readonly)

The key defines for the generator

Returns:



23
24
25
# File 'lib/KCommercialPipeline/core/resource/swift/swift_generator.rb', line 23

def keys
  @keys
end

#super_moduleString (readonly)

The super module default is MKResources

Returns:



19
20
21
# File 'lib/KCommercialPipeline/core/resource/swift/swift_generator.rb', line 19

def super_module
  @super_module
end

Instance Method Details

#extension_contentsObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/KCommercialPipeline/core/resource/swift/swift_generator.rb', line 33

def extension_contents
  <<EOF
//
//  SharedResources.swift
//  MKSharedResources
//
//  Created by Dong Zhao on 2020/12/31.
//
import MKResources
import #{super_module}
extension R {
#{append_prefix(swift_contents,"\t")}
}
EOF
end