Module: KissShot::ObjC::Protocol
Instance Method Summary collapse
-
#objc_protocol(name, supers = ["NSObject"]) ⇒ Object
For @protocol.
-
#objc_protocol_optional ⇒ Object
Add line for @optional.
-
#objc_protocol_required ⇒ Object
Add line for @required.
Methods included from Base
#_objc_bracket_array, #_objc_diamond_array
Instance Method Details
#objc_protocol(name, supers = ["NSObject"]) ⇒ Object
For @protocol
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/kiss_shot/objc/protocol.rb', line 26 def objc_protocol(name, supers = ["NSObject"]) # Add new line line # Declare raw "@protocol #{name}" if block_given? # If block given, add supers, and yield if supers.count raw " #{_objc_diamond_array(Array.wrap(supers))}" end # new line, no indent raw "\n" # yield yield # add @end line "@end" else # if no block given, just close line with ; raw ";\n" end self end |
#objc_protocol_optional ⇒ Object
Add line for @optional
16 17 18 19 20 |
# File 'lib/kiss_shot/objc/protocol.rb', line 16 def objc_protocol_optional line line "@optional" self end |
#objc_protocol_required ⇒ Object
Add line for @required
8 9 10 11 12 |
# File 'lib/kiss_shot/objc/protocol.rb', line 8 def objc_protocol_required line line "@required" self end |