Class: ObjCClass

Inherits:
Object
  • Object
show all
Defined in:
lib/mt_tool/short_hand/objc_shorthand.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ObjCClass

Returns a new instance of ObjCClass.



4
5
6
7
8
9
10
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 4

def initialize name
	@objc_name = name
	@objc_superclass_name = :NSObject
	@objc_ivars = {}
	@objc_frameworks = []
	@objc_imports = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, type = nil, *options) ⇒ Object



28
29
30
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 28

def method_missing name, type = nil, *options
	ivar name, type, *options
end

Instance Attribute Details

#objc_frameworksObject (readonly)

Returns the value of attribute objc_frameworks.



36
37
38
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 36

def objc_frameworks
  @objc_frameworks
end

#objc_importsObject (readonly)

Returns the value of attribute objc_imports.



36
37
38
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 36

def objc_imports
  @objc_imports
end

#objc_ivarsObject (readonly)

Returns the value of attribute objc_ivars.



36
37
38
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 36

def objc_ivars
  @objc_ivars
end

#objc_nameObject (readonly)

Returns the value of attribute objc_name.



36
37
38
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 36

def objc_name
  @objc_name
end

#objc_superclass_nameObject (readonly)

Returns the value of attribute objc_superclass_name.



36
37
38
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 36

def objc_superclass_name
  @objc_superclass_name
end

Instance Method Details

#framework(x) ⇒ Object



20
21
22
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 20

def framework x
	@objc_frameworks << x unless @objc_frameworks.include? x
end

#getter(name) ⇒ Object



32
33
34
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 32

def getter(name)
	return ObjCIvarGetterNameOption.new(name)
end

#import(x) ⇒ Object



24
25
26
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 24

def import x
	@objc_imports << x unless @objc_imports.include? x
end

#ivar(name, type = nil, *options) ⇒ Object



16
17
18
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 16

def ivar name, type = nil, *options
	@objc_ivars[name] = ObjCIvar.new name, type || :id, options
end

#subclass_of(x) ⇒ Object



12
13
14
# File 'lib/mt_tool/short_hand/objc_shorthand.rb', line 12

def subclass_of x
	@objc_superclass_name = x
end