Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 33 lines (24 sloc) 0.771 kb
344522f generate dependency from bundler gemspec, save/load from yml
David Goudreau & Kurtis Seebaldt authored
1 module LicenseFinder
2 class Dependency
3
4 attr_reader :name, :version, :license, :approved
5
6 def self.from_gemspec(gem_spec)
7 new(gem_spec.name, gem_spec.version, 'MIT', false)
8 end
9
10 def self.from_yaml(yml)
11 attrs = YAML.load(yml)
12 new(attrs['name'], attrs['version'], attrs['license'], attrs['approved'])
13 end
14
15 def self.from_hash(attrs)
16 new(attrs['name'], attrs['version'], attrs['license'], attrs['approved'])
17 end
18
19 def initialize(name, version, license, approved)
20 @name = name
21 @version = version
22 @license = license
23 @approved = approved
24 end
25
26 def to_yaml_entry
27 "- name: \"#{name}\"\n version: \"#{version}\"\n license: \"#{license}\"\n approved: #{approved}\n"
28 end
29
30 end
31 end
32
Something went wrong with that request. Please try again.