Class: SwiftGenerator::SwiftNonPrimitive
- Inherits:
-
Object
- Object
- SwiftGenerator::SwiftNonPrimitive
- Defined in:
- lib/swift_generator/code_generation/swift_class_generation.rb
Overview
Base class for Struct, Enum and Class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_control_modifiers ⇒ Object
Returns the value of attribute access_control_modifiers.
-
#class_characteristics ⇒ Object
Returns the value of attribute class_characteristics.
-
#definition_set ⇒ Object
Returns the value of attribute definition_set.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#inheritance_list ⇒ Object
Raw parent list.
-
#initializers ⇒ Object
Returns the value of attribute initializers.
-
#is_test_element ⇒ Object
Returns the value of attribute is_test_element.
-
#is_user_editable ⇒ Object
Returns the value of attribute is_user_editable.
-
#methods ⇒ Object
Returns the value of attribute methods.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#source_file ⇒ Object
Returns the value of attribute source_file.
-
#specified_type_name ⇒ Object
Returns the value of attribute specified_type_name.
-
#top_inner_comment_block ⇒ Object
Useful for converted Objective-C classes.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Instance Method Summary collapse
- #comparable_properties ⇒ Object
-
#initialize(definition_set, specified_type_name, inheritance_list = [], type_name: nil, file_name: nil, characteristics: [], is_user_editable: false, is_test_element: false) ⇒ SwiftNonPrimitive
constructor
A new instance of SwiftNonPrimitive.
- #make_property_type ⇒ Object
- #persistent_properties ⇒ Object
- #prepare_for_generation ⇒ Object
- #prepare_supporting_elements ⇒ Object
- #resolve_property_types ⇒ Object
- #swift_type_symbol ⇒ Object
- #transient_properties ⇒ Object
Constructor Details
#initialize(definition_set, specified_type_name, inheritance_list = [], type_name: nil, file_name: nil, characteristics: [], is_user_editable: false, is_test_element: false) ⇒ SwiftNonPrimitive
Returns a new instance of SwiftNonPrimitive.
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 107 108 109 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 81 def initialize( definition_set, specified_type_name, inheritance_list=[], type_name:nil, file_name: nil, characteristics:[], is_user_editable: false, is_test_element: false ) @definition_set = definition_set @specified_type_name = specified_type_name @inheritance_list = inheritance_list @type_name = type_name.nil? ? specified_type_name : type_name @file_name = file_name #@access_control_modifier = 'public ' @access_control_modifiers = [] @class_characteristics = [* characteristics] @is_user_editable = is_user_editable @is_test_element = is_test_element @methods = [] @initializers = [] @properties = [] @post_super_initializations = {} @top_inner_comment_block = [] # This class will now be added to the definition set and its source file # The source file will be created if needed. @definition_set.add_element(self) # Source file is now set @source_file.add_import('Foundation') end |
Instance Attribute Details
#access_control_modifiers ⇒ Object
Returns the value of attribute access_control_modifiers.
65 66 67 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 65 def access_control_modifiers @access_control_modifiers end |
#class_characteristics ⇒ Object
Returns the value of attribute class_characteristics.
77 78 79 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 77 def class_characteristics @class_characteristics end |
#definition_set ⇒ Object
Returns the value of attribute definition_set.
62 63 64 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 62 def definition_set @definition_set end |
#file_name ⇒ Object
Returns the value of attribute file_name.
68 69 70 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 68 def file_name @file_name end |
#inheritance_list ⇒ Object
Raw parent list
66 67 68 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 66 def inheritance_list @inheritance_list end |
#initializers ⇒ Object
Returns the value of attribute initializers.
74 75 76 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 74 def initializers @initializers end |
#is_test_element ⇒ Object
Returns the value of attribute is_test_element.
79 80 81 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 79 def is_test_element @is_test_element end |
#is_user_editable ⇒ Object
Returns the value of attribute is_user_editable.
78 79 80 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 78 def is_user_editable @is_user_editable end |
#methods ⇒ Object
Returns the value of attribute methods.
75 76 77 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 75 def methods @methods end |
#properties ⇒ Object
Returns the value of attribute properties.
73 74 75 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 73 def properties @properties end |
#source_file ⇒ Object
Returns the value of attribute source_file.
69 70 71 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 69 def source_file @source_file end |
#specified_type_name ⇒ Object
Returns the value of attribute specified_type_name.
64 65 66 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 64 def specified_type_name @specified_type_name end |
#top_inner_comment_block ⇒ Object
Useful for converted Objective-C classes
71 72 73 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 71 def top_inner_comment_block @top_inner_comment_block end |
#type_name ⇒ Object
Returns the value of attribute type_name.
63 64 65 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 63 def type_name @type_name end |
Instance Method Details
#comparable_properties ⇒ Object
119 120 121 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 119 def comparable_properties() persistent_properties end |
#make_property_type ⇒ Object
133 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 133 def make_property_type; raise $UNIMPLEMENTED; end |
#persistent_properties ⇒ Object
115 116 117 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 115 def persistent_properties() @properties.select { |prop| prop.is_persistent } end |
#prepare_for_generation ⇒ Object
135 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 135 def prepare_for_generation; raise $UNIMPLEMENTED; end |
#prepare_supporting_elements ⇒ Object
134 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 134 def prepare_supporting_elements; raise $UNIMPLEMENTED; end |
#resolve_property_types ⇒ Object
123 124 125 126 127 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 123 def resolve_property_types() @properties.each do |property| property.resolve_type end end |
#swift_type_symbol ⇒ Object
129 130 131 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 129 def swift_type_symbol return @type_name.to_sym end |
#transient_properties ⇒ Object
111 112 113 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 111 def transient_properties() @properties.select { |prop| !prop.is_persistent } end |