class SwiftPropertyType

Attributes

auto_bridged[RW]
custom_equality_test[RW]
custom_marshaling[RW]
custom_unmarshaling[RW]
hashable_value_lambda[RW]
serialized_json_type[RW]
swift_kind[RW]
swift_type_name[RW]
swift_type_symbol[RW]
test_value_lambda[RW]

Public Class Methods

all_swift_kinds() click to toggle source
# File lib/swift_generator/code_generation/swift_types.rb, line 33
def self.all_swift_kinds
        {
                primitive:   'Swift primitive, e.g. Int, String',
                class:               'Swift Class',
                struct:              'Swift Struct',
                enum:                'Swift Enum'
        }
end
new( swift_type_symbol, serialized_json_type, auto_bridged:false, swift_kind: :primitive, test_value:lambda{|num| 'undefined' }, unmarshal_method: nil) click to toggle source
# File lib/swift_generator/code_generation/swift_types.rb, line 20
def initialize( swift_type_symbol, serialized_json_type, auto_bridged:false, swift_kind: :primitive,
                                test_value:lambda{|num| 'undefined' }, unmarshal_method: nil)
        @swift_type_symbol = swift_type_symbol
        @swift_type_name = swift_type_symbol.to_s
        @serialized_json_type = serialized_json_type
        @auto_bridged = auto_bridged
        @swift_kind = swift_kind
        @test_value_lambda = test_value
        @custom_equality_test = nil
        @hashable_value_lambda = nil
        @unmarshal_method_lambda = unmarshal_method
end

Public Instance Methods

hashable_value( var_name, is_optional) click to toggle source
# File lib/swift_generator/code_generation/swift_types.rb, line 46
def hashable_value( var_name, is_optional)
        if @hashable_value_lambda.nil?
                return var_name
        else
                return @hashable_value_lambda.call( var_name, is_optional )
        end
end
make_test_value( index ) click to toggle source
# File lib/swift_generator/code_generation/swift_types.rb, line 42
def make_test_value( index )
        @test_value_lambda.call( index )
end