Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/cog/native_extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#each_with_cog_source {|source, source_type, path| ... } ⇒ Object

Iterate through each path in this array

Yield Parameters:

  • source (String)

    readable label for the source. In the case of plugins, the plugin name

  • source_type (Symbol)

    one of :built_in, :user, :plugin, or :project

  • path (String)

    a path to a cog resource, such as a template or generator

Returns:

  • (Object)

    the return value of the block



9
10
11
12
13
14
15
16
17
18
# File 'lib/cog/native_extensions/array.rb', line 9

def each_with_cog_source(&block)
  each do |path|
    source, source_type = if plugin = path.relative_to_which_plugin?
      [plugin.name, :plugin]
    else
      path.cog_source_and_type
    end
    block.call source, source_type, path
  end
end