lib/ib/generator.rb in ib-0.1.3 vs lib/ib/generator.rb in ib-0.1.4

- old
+ new

@@ -35,12 +35,14 @@ <<-OBJC @interface #{info[:class][0][0]} : #{info[:class][0][1]} #{info[:outlets].map {|name, type| "@property IBOutlet #{generate_type(type)} #{name};" }.join("\n")} -#{info[:actions].map {|action| "-(IBAction) #{action[0]}:(id) sender;" }.join("\n")} +#{info[:outlet_collections].map {|name, type| "@property IBOutletCollection(#{type}) NSArray * #{name};" }.join("\n")} +#{info[:actions].map {|action| "-(IBAction) #{generate_action(action)};" }.join("\n")} + @end OBJC end.join("\n" * 2) end @@ -55,6 +57,10 @@ end def generate_type type type == "id" ? type : "#{type} *" end -end \ No newline at end of file + + def generate_action action + action[1] ? "#{action[0]}:(id) #{action[1]}" : "#{action[0]}" + end +end