Class: ObjCClass
- Inherits:
-
Object
- Object
- ObjCClass
- Defined in:
- lib/mt_tool/short_hand/objc_shorthand.rb
Instance Attribute Summary collapse
-
#objc_frameworks ⇒ Object
readonly
Returns the value of attribute objc_frameworks.
-
#objc_imports ⇒ Object
readonly
Returns the value of attribute objc_imports.
-
#objc_ivars ⇒ Object
readonly
Returns the value of attribute objc_ivars.
-
#objc_name ⇒ Object
readonly
Returns the value of attribute objc_name.
-
#objc_superclass_name ⇒ Object
readonly
Returns the value of attribute objc_superclass_name.
Instance Method Summary collapse
- #framework(x) ⇒ Object
- #getter(name) ⇒ Object
- #import(x) ⇒ Object
-
#initialize(name) ⇒ ObjCClass
constructor
A new instance of ObjCClass.
- #ivar(name, type = nil, *options) ⇒ Object
- #method_missing(name, type = nil, *options) ⇒ Object
- #subclass_of(x) ⇒ Object
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, * ivar name, type, * end |
Instance Attribute Details
#objc_frameworks ⇒ Object (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_imports ⇒ Object (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_ivars ⇒ Object (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_name ⇒ Object (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_name ⇒ Object (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, * @objc_ivars[name] = ObjCIvar.new name, type || :id, 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 |