Module: Pod::Downloader::APIExposable

Included in:
Base
Defined in:
lib/cocoapods-downloader/api_exposable.rb

Instance Method Summary collapse

Instance Method Details

#expose_api(mod = nil, &block) ⇒ Object Also known as: override_api


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cocoapods-downloader/api_exposable.rb', line 4

def expose_api(mod = nil, &block)
  if mod.nil?
    if block.nil?
      raise "Either a module or a block that's used to create a module is required."
    else
      mod = Module.new(&block)
    end
  elsif mod && block
    raise 'Only a module *or* is required, not both.'
  end
  include mod
  # TODO: Try to find a nicer way to do this
  # See https://github.com/CocoaPods/cocoapods-downloader/pull/57
  extend mod
end