templates/Keys.m.erb in cocoapods-keys-2.2.0 vs templates/Keys.m.erb in cocoapods-keys-2.2.1
- old
+ new
@@ -19,21 +19,25 @@
- (instancetype)init
{
if (!(self = [super init])) { return nil; }
<% @keys.each do |key, value| %>
- char <%= key %>CString[<%= @indexed_keys[key].length + 1 %>] = { <%= key_data_arrays[key] %>, '\0' };
+ <% if @indexed_keys[key].length > 0 %>
+ char <%= key %>CString[<%= @indexed_keys[key].length + 1 %>] = { <%= key_data_arrays[key] %>, '\0' };
+ <% else %>
+ char <%= key %>CString[<%= @indexed_keys[key].length + 1 %>] = { '\0' };
+ <% end %>
_<%= key %> = <% if @indexed_keys.length > 0 %>
<% if @indexed_keys[key].length > 0 %>
[NSString stringWithCString:<%= key %>CString encoding:NSUTF8StringEncoding];
<% else %>
@"";
<% end %>
<% else %>
@"";
<% end %>
<% end %>
-
+
return self;
}
static NSString *<%= name %>Data = @"<%= @data.gsub('\\', '\\\\\\').gsub('"', '\\"') if @data %>";