Class: SwiftPropertyType
- Inherits:
-
Object
- Object
- SwiftPropertyType
- Defined in:
- lib/swift_generator/code_generation/swift_types.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#auto_bridged ⇒ Object
Returns the value of attribute auto_bridged.
-
#custom_equality_test ⇒ Object
Returns the value of attribute custom_equality_test.
-
#custom_marshaling ⇒ Object
Returns the value of attribute custom_marshaling.
-
#custom_unmarshaling ⇒ Object
Returns the value of attribute custom_unmarshaling.
-
#hashable_value_lambda ⇒ Object
Returns the value of attribute hashable_value_lambda.
-
#serialized_json_type ⇒ Object
Returns the value of attribute serialized_json_type.
-
#swift_kind ⇒ Object
Returns the value of attribute swift_kind.
-
#swift_type_name ⇒ Object
Returns the value of attribute swift_type_name.
-
#swift_type_symbol ⇒ Object
Returns the value of attribute swift_type_symbol.
-
#test_value_lambda ⇒ Object
Returns the value of attribute test_value_lambda.
Class Method Summary collapse
Instance Method Summary collapse
- #hashable_value(var_name, is_optional) ⇒ Object
-
#initialize(swift_type_symbol, serialized_json_type, auto_bridged: false, swift_kind: :primitive, test_value: lambda{|num| 'undefined' }, unmarshal_method: nil) ⇒ SwiftPropertyType
constructor
A new instance of SwiftPropertyType.
- #make_test_value(index) ⇒ Object
Constructor Details
#initialize(swift_type_symbol, serialized_json_type, auto_bridged: false, swift_kind: :primitive, test_value: lambda{|num| 'undefined' }, unmarshal_method: nil) ⇒ SwiftPropertyType
Returns a new instance of SwiftPropertyType.
20 21 22 23 24 25 26 27 28 29 30 31 |
# 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 |
Instance Attribute Details
#auto_bridged ⇒ Object
Returns the value of attribute auto_bridged.
12 13 14 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 12 def auto_bridged @auto_bridged end |
#custom_equality_test ⇒ Object
Returns the value of attribute custom_equality_test.
17 18 19 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 17 def custom_equality_test @custom_equality_test end |
#custom_marshaling ⇒ Object
Returns the value of attribute custom_marshaling.
15 16 17 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 15 def custom_marshaling @custom_marshaling end |
#custom_unmarshaling ⇒ Object
Returns the value of attribute custom_unmarshaling.
16 17 18 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 16 def custom_unmarshaling @custom_unmarshaling end |
#hashable_value_lambda ⇒ Object
Returns the value of attribute hashable_value_lambda.
18 19 20 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 18 def hashable_value_lambda @hashable_value_lambda end |
#serialized_json_type ⇒ Object
Returns the value of attribute serialized_json_type.
11 12 13 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 11 def serialized_json_type @serialized_json_type end |
#swift_kind ⇒ Object
Returns the value of attribute swift_kind.
13 14 15 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 13 def swift_kind @swift_kind end |
#swift_type_name ⇒ Object
Returns the value of attribute swift_type_name.
10 11 12 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 10 def swift_type_name @swift_type_name end |
#swift_type_symbol ⇒ Object
Returns the value of attribute swift_type_symbol.
9 10 11 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 9 def swift_type_symbol @swift_type_symbol end |
#test_value_lambda ⇒ Object
Returns the value of attribute test_value_lambda.
14 15 16 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 14 def test_value_lambda @test_value_lambda end |
Class Method Details
.all_swift_kinds ⇒ Object
33 34 35 36 37 38 39 40 |
# 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 |
Instance Method Details
#hashable_value(var_name, is_optional) ⇒ Object
46 47 48 49 50 51 52 |
# 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) ⇒ Object
42 43 44 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 42 def make_test_value( index ) @test_value_lambda.call( index ) end |