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



5
6
7
# File 'lib/dpl/support/gems.rb', line 5

def glob
  @glob
end

#optsObject

Returns the value of attribute opts

Returns:

  • (Object)

    the current value of opts



5
6
7
# File 'lib/dpl/support/gems.rb', line 5

def opts
  @opts
end

Instance Method Details

#allObject



10
11
12
13
14
15
# File 'lib/dpl/support/gems.rb', line 10

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



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

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

#exceptObject



17
18
19
# File 'lib/dpl/support/gems.rb', line 17

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