Sha256: aef2e42c1d3eab1367f52680685ed2bd33a3e1dbac37d055abdc14b9fdfded57
Contents?: true
Size: 804 Bytes
Versions: 2
Compression:
Stored size: 804 Bytes
Contents
module Sign class Fetcher @@list = {} Dir["vendor/licenses/*.txt"].select do |file| if File.file?(file) name = File.basename(file, ".txt") info = File.open(file){ |file| file.readline }.downcase.strip.gsub(/[^-a-z0-9\s]/, "") @@list[name] = info end end def self.get_list format = "%-16s %10s" @@list.each do |name, info| puts format % [name, info] end end def get(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 def license_path File.expand_path("../../vendor/licenses", __dir__) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sign-1.0.0 | lib/sign/fetcher.rb |
sign-0.6.0 | lib/sign/fetcher.rb |