Class: Nidyx::ObjCProperty
- Inherits:
-
Object
- Object
- Nidyx::ObjCProperty
- Includes:
- ObjCConstants
- Defined in:
- lib/nidyx/objc/property.rb
Defined Under Namespace
Classes: UnsupportedEnumTypeError
Constant Summary
Constants included from ObjCConstants
Nidyx::ObjCConstants::ATTRIBUTES, Nidyx::ObjCConstants::BOXABLE_NUMBERS, Nidyx::ObjCConstants::ENUM_TYPES, Nidyx::ObjCConstants::FORBIDDEN_PROPERTY_PREFIXES, Nidyx::ObjCConstants::OBJECTS, Nidyx::ObjCConstants::OBJECT_ATTRIBUTES, Nidyx::ObjCConstants::PRIMITIVE_ATTRIBUTES, Nidyx::ObjCConstants::SIMPLE_NUMBERS, Nidyx::ObjCConstants::TYPES
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#desc ⇒ Object
readonly
Returns the value of attribute desc.
-
#getter_override ⇒ Object
readonly
Returns the value of attribute getter_override.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#protocols ⇒ Object
readonly
Returns the value of attribute protocols.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Instance Method Summary collapse
-
#has_protocols? ⇒ Boolean
True if the property has protocols.
-
#initialize(property) ⇒ ObjCProperty
constructor
A new instance of ObjCProperty.
-
#is_obj? ⇒ Boolean
True if the obj-c property type is an object.
-
#protocols_string ⇒ String
The property’s protocols, comma separated.
Constructor Details
#initialize(property) ⇒ ObjCProperty
Returns a new instance of ObjCProperty.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/nidyx/objc/property.rb', line 16 def initialize(property) @name = property.name @optional = property.optional @desc = property.description @getter_override = process_getter_override(name) @type = process_type(property) @attributes = ATTRIBUTES[@type] @type_name = lookup_type_name(@type, property.class_name) @protocols = [] # Exclude any standard objc types from the protocols @protocols += Nidyx::ObjCUtils.filter_standard_types(property.collection_types) if property.collection_types @protocols << "Optional" if @optional end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def attributes @attributes end |
#desc ⇒ Object (readonly)
Returns the value of attribute desc.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def desc @desc end |
#getter_override ⇒ Object (readonly)
Returns the value of attribute getter_override.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def getter_override @getter_override end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def name @name end |
#protocols ⇒ Object (readonly)
Returns the value of attribute protocols.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def protocols @protocols end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def type @type end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
12 13 14 |
# File 'lib/nidyx/objc/property.rb', line 12 def type_name @type_name end |
Instance Method Details
#has_protocols? ⇒ Boolean
Returns true if the property has protocols.
38 39 40 |
# File 'lib/nidyx/objc/property.rb', line 38 def has_protocols? !@protocols.empty? end |
#is_obj? ⇒ Boolean
Returns true if the obj-c property type is an object.
33 34 35 |
# File 'lib/nidyx/objc/property.rb', line 33 def is_obj? OBJECTS.include?(self.type) end |
#protocols_string ⇒ String
Returns the property’s protocols, comma separated.
43 44 45 |
# File 'lib/nidyx/objc/property.rb', line 43 def protocols_string @protocols.join(", ") end |