Class: Sign::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/sign/fetcher.rb

Constant Summary collapse

@@list =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get_listObject



13
14
15
16
17
18
19
# File 'lib/sign/fetcher.rb', line 13

def self.get_list
  format = "%-16s %10s"
  
  @@list.each do |name, info| 
    puts format % [name, info]
  end
end

Instance Method Details

#get_license(license) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/sign/fetcher.rb', line 21

def get_license(license)
  if @@list.has_key?(license.downcase)
    file_name = "#{license}.txt"
    File.open("#{license_path}/#{file_name}")
  else
    raise ArgumentError, "#{license} is not available."
  end
end

#license_pathObject



30
31
32
# File 'lib/sign/fetcher.rb', line 30

def license_path
  File.expand_path("../../vendor/licenses", __dir__)
end