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_modifier ⇒ Object
Returns the value of attribute access_control_modifier.
-
#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.
-
#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.
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 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 79 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_modifier = '' @class_characteristics = [* characteristics] @is_user_editable = is_user_editable @is_test_element = is_test_element @methods = [] @initializers = [] @properties = [] @post_super_initializations = {} # 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_modifier ⇒ Object
Returns the value of attribute access_control_modifier.
65 66 67 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 65 def access_control_modifier @access_control_modifier end |
#class_characteristics ⇒ Object
Returns the value of attribute class_characteristics.
75 76 77 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 75 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.
72 73 74 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 72 def initializers @initializers end |
#is_test_element ⇒ Object
Returns the value of attribute is_test_element.
77 78 79 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 77 def is_test_element @is_test_element end |
#is_user_editable ⇒ Object
Returns the value of attribute is_user_editable.
76 77 78 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 76 def is_user_editable @is_user_editable end |
#methods ⇒ Object
Returns the value of attribute methods.
73 74 75 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 73 def methods @methods end |
#properties ⇒ Object
Returns the value of attribute properties.
71 72 73 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 71 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 |
#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
115 116 117 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 115 def comparable_properties() persistent_properties end |
#make_property_type ⇒ Object
129 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 129 def make_property_type; raise $UNIMPLEMENTED; end |
#persistent_properties ⇒ Object
111 112 113 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 111 def persistent_properties() @properties.select { |prop| prop.is_persistent } end |
#prepare_for_generation ⇒ Object
131 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 131 def prepare_for_generation; raise $UNIMPLEMENTED; end |
#prepare_supporting_elements ⇒ Object
130 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 130 def prepare_supporting_elements; raise $UNIMPLEMENTED; end |
#resolve_property_types ⇒ Object
119 120 121 122 123 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 119 def resolve_property_types() @properties.each do |property| property.resolve_type end end |
#swift_type_symbol ⇒ Object
125 126 127 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 125 def swift_type_symbol return @type_name.to_sym end |
#transient_properties ⇒ Object
107 108 109 |
# File 'lib/swift_generator/code_generation/swift_class_generation.rb', line 107 def transient_properties() @properties.select { |prop| !prop.is_persistent } end |