Sha256: d92c4eeeb2a1bb6bba3b1ed34b2cb243a11ad3ac896837d1705a1cc2c6b1cb06

Contents?: true

Size: 703 Bytes

Versions: 2

Compression:

Stored size: 703 Bytes

Contents

class Licensee
  class Licenses
    class << self
      def names
        @names ||= begin
          names = Dir.entries(base)
          names.map! { |l| File.basename(l, ".txt") }
          names.reject! { |l| l =~ /^\./ || l.nil? }
          names
        end
      end

      def list
        @licenses ||= begin
          licenses = []
          names.each { |name| licenses.push License.new(name) }
          licenses
        end
      end

      def base
        @base ||= File.expand_path "../../vendor/choosealicense.com/_licenses", File.dirname(__FILE__)
      end

      def find(name)
        name = name.downcase
        list.find { |l| l.name.downcase == name }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licensee-0.2.0 lib/licensee/licenses.rb
licensee-0.1.1 lib/licensee/licenses.rb