Module: SwiftTemplateHelper

Defined in:
lib/arkana/helpers/swift_template_helper.rb

Overview

Utilities to reduce the amount of boilerplate code in ‘.swift.erb` template files.

Class Method Summary collapse

Class Method Details

.protocol_getter(declaration_strategy) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/arkana/helpers/swift_template_helper.rb', line 14

def self.protocol_getter(declaration_strategy)
  case declaration_strategy
    when "lazy var" then "mutating get"
    when "var", "let" then "get"
    else raise "Unknown declaration strategy '#{declaration_strategy}' received.'"
  end
end

.swift_type(type) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/arkana/helpers/swift_template_helper.rb', line 5

def self.swift_type(type)
  case type
    when :string then "String"
    when :boolean then "Bool"
    when :integer then "Int"
    else raise "Unknown variable type '#{type}' received.'"
  end
end