Class: Mona::Package::Repo
- Inherits:
-
Object
- Object
- Mona::Package::Repo
- Includes:
- Deps[ "package.list", ], Mixins
- Defined in:
- lib/mona/package/repo.rb
Constant Summary collapse
Instance Method Summary collapse
- #all ⇒ Object
- #filter(name: nil) ⇒ Object
- #find(package_name) ⇒ Object
- #find!(package_name) ⇒ Object
Methods included from Mixins
Instance Method Details
#all ⇒ Object
13 14 15 |
# File 'lib/mona/package/repo.rb', line 13 def all list.call end |
#filter(name: nil) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mona/package/repo.rb', line 31 def filter(name: nil) packages = all unless name.nil? names = name.is_a?(Array) ? name : [name] names = names.map(&:to_sym) packages = packages.select { names.include?(_1.name) } end packages end |
#find(package_name) ⇒ Object
50 51 52 |
# File 'lib/mona/package/repo.rb', line 50 def find(package_name) all.detect { _1.name == package_name.to_sym } end |
#find!(package_name) ⇒ Object
60 61 62 |
# File 'lib/mona/package/repo.rb', line 60 def find!(package_name) find(package_name) || (raise StandardError.new("package '#{package_name}' was not found for Mona project '#{Mona.current_project.root_path}'")) end |