Top Level Namespace
Defined Under Namespace
Modules: Ribosome, SwiftGenerator Classes: StringEnumPropertyType, SwiftObjectPropertyType, SwiftPropertyType, USIWireDataClass
Instance Method Summary collapse
-
#amp ⇒ Object
Escape function for &.
-
#at ⇒ Object
Escape function for @.
- #initial_property_types ⇒ Object
-
#slash ⇒ Object
Escape function for /.
Instance Method Details
#amp ⇒ Object
Escape function for &
324 325 326 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 324 def amp() return "&" end |
#at ⇒ Object
Escape function for @
319 320 321 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 319 def at() return "@" end |
#initial_property_types ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/swift_generator/code_generation/swift_types.rb', line 76 def initial_property_types iso_date = SwiftPropertyType.new( :NSDate, :String, auto_bridged:false, test_value: $date_lambda ) iso_date.custom_marshaling = lambda{|dest, value| "#{dest} = DateFormatting.isoStringFromDate( #{value} )" } iso_date.custom_unmarshaling = lambda{|dest, value| "#{dest} = DateFormatting.dateFromISOString( #{value} )" } iso_date.custom_equality_test = lambda{|name, other| "optionalDatesEqual( #{name}, #{other})" } int_type = SwiftPropertyType.new( :Int, :NSNumber, auto_bridged:true, test_value: $number_lambda ) uint_type = SwiftPropertyType.new( :UInt, :NSNumber, auto_bridged:true, test_value: $number_lambda ) float_type = SwiftPropertyType.new( :Float, :NSNumber, auto_bridged:true, test_value: $number_lambda ) double_type = SwiftPropertyType.new( :Double, :NSNumber, auto_bridged:true, test_value: $number_lambda ) bool_type = SwiftPropertyType.new( :Bool, :NSNumber, auto_bridged:true, test_value: lambda{|num| return num.even? ? 'true' : 'false' }) int_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.integerValue" } uint_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.unsignedIntegerValue" } float_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.floatValue" } double_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.doubleValue" } bool_type.custom_unmarshaling = lambda{|dest, value| "#{dest} = #{value}.boolValue" } return [ int_type, uint_type, float_type, double_type, bool_type, SwiftPropertyType.new( :String, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :NSString, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :USIObjectID, :NSString, auto_bridged:true, test_value: $string_lambda ), SwiftPropertyType.new( :AnvilEndpoint, :AnvilEndpoint, auto_bridged:true, test_value: nil ), iso_date ] end |
#slash ⇒ Object
Escape function for /
329 330 331 |
# File 'lib/swift_generator/code_generation/swift_file_template.rb', line 329 def slash() return "/" end |