Sha256: 8d4cec8810f1d7975d0eb1f1012d422c9a965b9615e98a3349c58b9924c2c65b

Contents?: true

Size: 1.64 KB

Versions: 1

Compression:

Stored size: 1.64 KB

Contents

//
// Generated by CocoaPods-Keys
// on <%= @time.strftime("%d/%m/%Y") %>
// For more information see https://github.com/cocoapods/cocoapods-keys
//

#import <objc/runtime.h>
#import <Foundation/NSDictionary.h>
#import "<%= @name %>.h"

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincomplete-implementation"

@implementation <%= @name %>

#pragma clang diagnostic pop

+ (BOOL)resolveInstanceMethod:(SEL)name
{
  NSString *key = NSStringFromSelector(name);
  NSString * (*implementation)(<%= name %> *, SEL) = NULL;
<% @keys.each do |key, value| %>
  if ([key isEqualToString:@"<%= key %>"]) {
    implementation = _podKeys<%= Digest::MD5.hexdigest(key) %>;
  }
<% end %>
  if (!implementation) {
    return [super resolveInstanceMethod:name];
  }

  return class_addMethod([self class], name, (IMP)implementation, "@@:");
}
<% @keys.each do |key, value| %>
static NSString *_podKeys<%= Digest::MD5.hexdigest(key) %>(<%= name %> *self, SEL _cmd)
{
  <% if @indexed_keys.length > 0 %>
    <% if @indexed_keys[key].length > 0 %>
      char cString[<%= @indexed_keys[key].length + 1 %>] = { <%= key_data_arrays[key] %>, '\0' };
    <% else %>
      char cString[1] = { '\0' };
    <% end %>
    return [NSString stringWithCString:cString encoding:NSUTF8StringEncoding];
  <% else %>
    return @"";
  <% end %>
}
<% end %>

static char <%= name %>Data[<%= @data_length %>] = "<%= @data.gsub('\\', '\\\\\\').gsub('"', '\\"') if @data %>";

- (NSString *)description
{
  return [@{
<%- @keys.each do |key, value| -%>
            @"<%= key %>": self.<%= key %>,
<%- end -%>
  } description];
}

- (id)debugQuickLookObject
{
  return [self description];
}

@end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cocoapods-keys-1.1.0 templates/Keys.m.erb