Class: Jaspion::Kilza::Objc::Property

Inherits:
Property
  • Object
show all
Defined in:
lib/jaspion/kilza/language/objc/property.rb

Instance Attribute Summary

Attributes inherited from Property

#array, #key, #name, #original_name, #original_type, #type

Instance Method Summary collapse

Methods inherited from Property

#==, #boolean?, clean, #fixnum?, #float?, normalize, #null?, #object?, #to_s

Constructor Details

#initialize(name, type, array, key = '') ⇒ Property

Returns a new instance of Property.



6
7
8
9
10
11
12
13
# File 'lib/jaspion/kilza/language/objc/property.rb', line 6

def initialize(name, type, array, key = '')
  original_name = name
  unless RESERVED_WORDS.index(name.downcase).nil?
    name = RESERVED_PROPERTY_PREFIX + name
  end
  super(name, type, array, key)
  @original_name = original_name
end

Instance Method Details

#class_nameObject



15
16
17
18
19
20
21
# File 'lib/jaspion/kilza/language/objc/property.rb', line 15

def class_name
  return if !(object? || (array? && null?))

  class_name = super
  class_name = class_name + RESERVED_CLASS_POSFIX unless RESERVED_WORDS.index(class_name.downcase).nil?
  class_name
end

#class_referenceObject



23
24
25
# File 'lib/jaspion/kilza/language/objc/property.rb', line 23

def class_reference
  return "@class #{class_name};" unless class_name.nil? || array?
end

#constants(cl_name) ⇒ Object



31
32
33
# File 'lib/jaspion/kilza/language/objc/property.rb', line 31

def constants(cl_name)
  "NSString *const k#{cl_name}#{@name.capitalize} = @\"#{@original_name}\";"
end

#declarationObject



27
28
29
# File 'lib/jaspion/kilza/language/objc/property.rb', line 27

def declaration
  "@property (nonatomic, strong, nullable) #{@type} #{@name};"
end