Class: KZ::KZSwiftParagraph

Inherits:
KZSwiftContext show all
Defined in:
lib/cocoapods-kz/helpers/repair_dynamic_swift.rb

Instance Method Summary collapse

Constructor Details

#initialize(type_contexts, need_handle_func) ⇒ KZSwiftParagraph

Returns a new instance of KZSwiftParagraph.



63
64
65
66
# File 'lib/cocoapods-kz/helpers/repair_dynamic_swift.rb', line 63

def initialize(type_contexts, need_handle_func)
  @type_contexts = type_contexts
  @need_handle_func = need_handle_func
end

Instance Method Details

#get_oc_feature_contextsObject



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cocoapods-kz/helpers/repair_dynamic_swift.rb', line 68

def get_oc_feature_contexts
  if @need_handle_func
    new_class_context = []

    for context in @type_contexts
      if context.include?("init()") && !context.include?("override")
        context = context.sub("init()", "override init()")
        context = context.sub("{", "{\nsuper.init()")
      end
      new_class_context << context
    end
    return new_class_context
  else
    return @type_contexts
  end
end