Sha256: 9884a9a35bd88458b9a195e5a2313bb4ab58ab4bba749423f3641730e4f41092
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 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(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.2 | lib/sign/fetcher.rb |
sign-1.0.1 | lib/sign/fetcher.rb |