Sha256: 9df7879be7be1c7515179d36dc011eb58a33d4217f3dd8daebc1dae069ce7adf
Contents?: true
Size: 1.12 KB
Versions: 2
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby class ObjCClass def initialize name @objc_name = name @objc_superclass_name = :NSObject @objc_ivars = {} @objc_frameworks = [] @objc_imports = [] end def subclass_of x @objc_superclass_name = x end def ivar name, type = nil, *options @objc_ivars[name] = ObjCIvar.new name, type || :id, options end def framework x @objc_frameworks << x unless @objc_frameworks.include? x end def import x @objc_imports << x unless @objc_imports.include? x end def method_missing name, type = nil, *options ivar name, type, *options end def getter(name) return ObjCIvarGetterNameOption.new(name) end attr_reader :objc_name, :objc_ivars, :objc_frameworks, :objc_imports, :objc_superclass_name end class ObjCIvarGetterNameOption def initialize name @name = name end attr_reader :name end class ObjCIvar def initialize name, type, options @name = name @objc_type = type @options = options end attr_reader :name, :objc_type, :options end OBJC_CLASSES = {} unless def objc_class name, &block x = ObjCClass.new(name) OBJC_CLASSES[name] = x x.instance_eval(&block) x end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mt_tool-0.1.5 | lib/mt_tool/short_hand/objc_shorthand.rb |
mt_tool-0.1.4 | lib/mt_tool/short_hand/objc_shorthand.rb |