Class: VimPK::Commands::List

Inherits:
Object
  • Object
show all
Defined in:
lib/vimpk/commands/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ List

Returns a new instance of List.



8
9
10
11
12
# File 'lib/vimpk/commands/list.rb', line 8

def initialize(options)
  @path = options.path
  @pack = options.pack || "*"
  @type = options.type || "{start,opt}"
end

Instance Attribute Details

#destObject (readonly)

Returns the value of attribute dest.



6
7
8
# File 'lib/vimpk/commands/list.rb', line 6

def dest
  @dest
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
# File 'lib/vimpk/commands/list.rb', line 14

def call
  pattern = File.join(@path, @pack, @type, "*")
  glob = Dir.glob(pattern)

  raise PackageNotFoundError, "No packages were found in #{pattern}." if glob.empty?

  glob
end