Sha256: bc7f08966ca3454506137004762625d0630897c28beeea7df8dc8f06ed11bf84

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 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)
        list.find { |l| l.name == name }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
licensee-0.0.3 lib/licensee/licenses.rb
licensee-0.0.2 lib/licensee/licenses.rb
licensee-0.0.1 lib/licensee/licenses.rb