Class: Defgen::Property::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/defgen/property/attributes.rb

Constant Summary collapse

VALID_OWNERSHIPS =
[:strong, :weak, :assign, :unsafe_unretained, :retain, :copy]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttributes

Returns a new instance of Attributes.



8
9
10
# File 'lib/defgen/property/attributes.rb', line 8

def initialize
  @ownership = :strong
end

Instance Attribute Details

#getterObject

Returns the value of attribute getter.



6
7
8
# File 'lib/defgen/property/attributes.rb', line 6

def getter
  @getter
end

#ownershipObject

Returns the value of attribute ownership.



6
7
8
# File 'lib/defgen/property/attributes.rb', line 6

def ownership
  @ownership
end

#propertyObject

Returns the value of attribute property.



6
7
8
# File 'lib/defgen/property/attributes.rb', line 6

def property
  @property
end

Instance Method Details

#formatted_getterObject



28
29
30
31
32
# File 'lib/defgen/property/attributes.rb', line 28

def formatted_getter
  unless getter.nil? || getter.empty?
    "getter=#{property.prefix.downcase}_#{getter}"
  end
end

#to_sObject



24
25
26
# File 'lib/defgen/property/attributes.rb', line 24

def to_s
  "(#{['nonatomic', ownership, formatted_getter].compact.join(', ')})"
end