Class: Pod::HooksManager::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/hooks_manager.rb

Overview

Represents a single registered hook.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, plugin_name, block) ⇒ Hook

Initialize a new instance

Parameters:

Raises:

  • (ArgumentError)


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cocoapods/hooks_manager.rb', line 45

def initialize(name, plugin_name, block)
  raise ArgumentError, 'Missing name' unless name
  raise ArgumentError, 'Missing block' unless block

  UI.warn '[Hooks] The use of hooks without specifying a `plugin_name` ' \
          "has been deprecated (from file `#{block.binding.eval('File.expand_path __FILE__')}`)." unless plugin_name

  @name = name
  @plugin_name = plugin_name
  @block = block
end

Instance Attribute Details

#blockProc (readonly)

Returns The block.

Returns:

  • (Proc)

    The block.



35
36
37
# File 'lib/cocoapods/hooks_manager.rb', line 35

def block
  @block
end

#nameString (readonly)

Returns The name of the hook.

Returns:

  • (String)

    The name of the hook.



30
31
32
# File 'lib/cocoapods/hooks_manager.rb', line 30

def name
  @name
end

#plugin_nameString (readonly)

Returns The name of the plugin that registered the hook.

Returns:

  • (String)

    The name of the plugin that registered the hook.



25
26
27
# File 'lib/cocoapods/hooks_manager.rb', line 25

def plugin_name
  @plugin_name
end