Class: Debci::ExtraAptSourcesList

Inherits:
Object
  • Object
show all
Defined in:
lib/debci/extra_apt_sources_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ ExtraAptSourcesList

Returns a new instance of ExtraAptSourcesList.



5
6
7
8
9
10
11
12
13
14
# File 'lib/debci/extra_apt_sources_list.rb', line 5

def initialize(file)
  if File.exist?(file)
    @extra_apt_sources_list = YAML.safe_load(File.read(file))
    @extra_apt_sources_list.each do |key, value|
      @extra_apt_sources_list[key] = Debci::ExtraAptSource.new(value['entry'], value['allowed_users'], value['signing_key'])
    end
  else
    @extra_apt_sources_list = {}
  end
end

Instance Method Details

#allowed_extra_apt_sources(user) ⇒ Object



20
21
22
# File 'lib/debci/extra_apt_sources_list.rb', line 20

def allowed_extra_apt_sources(user)
  @extra_apt_sources_list.select { |_key, value| value.allowed?(user) }.keys
end

#find(name) ⇒ Object



16
17
18
# File 'lib/debci/extra_apt_sources_list.rb', line 16

def find(name)
  @extra_apt_sources_list[name]
end