Class: Dpl::Support::Gems

Inherits:
Struct
  • Object
show all
Defined in:
lib/dpl/support/gems.rb

Defined Under Namespace

Classes: Parse

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#globObject

Returns the value of attribute glob

Returns:

  • (Object)

    the current value of glob



7
8
9
# File 'lib/dpl/support/gems.rb', line 7

def glob
  @glob
end

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



7
8
9
# File 'lib/dpl/support/gems.rb', line 7

def opts
  @opts
end

Instance Method Details

#allObject



12
13
14
15
16
17
18
# File 'lib/dpl/support/gems.rb', line 12

def all
  Dir[glob].sort.inject([]) do |gems, path|
    next gems if except.any? { |str| path.include?(str) }

    gems + Parse.new(File.read(path)).gems
  end
end

#each(&block) ⇒ Object



8
9
10
# File 'lib/dpl/support/gems.rb', line 8

def each(&block)
  all.uniq.each(&block)
end

#exceptObject



20
21
22
# File 'lib/dpl/support/gems.rb', line 20

def except
  @except ||= Array(opts[:except]).map(&:to_s)
end