Sha256: 0892809b47abeed5995d37da8c59535ff18c3b5b5f215ff6da53c2d9277a02bc
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
module Licensee class Rule attr_reader :tag, :label, :description, :group def initialize(tag: nil, label: nil, description: nil, group: nil) @tag = tag @label = label @description = description @group = group end def inspect "#<Licensee::Rule @tag=\"#{tag}\">" end class << self def all @all ||= raw_rules.map do |group, rules| rules.map do |rule| Rule.new( tag: rule['tag'], label: rule['label'], description: rule['description'], group: group ) end end.flatten end def find_by_tag(tag) Rule.all.find { |r| r.tag == tag } end def file_path dir = File.dirname(__FILE__) File.expand_path '../../vendor/choosealicense.com/_data/rules.yml', dir end def raw_rules YAML.safe_load File.read(Rule.file_path) end def groups Rule.raw_rules.keys end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
licensee-8.8.4 | lib/licensee/rule.rb |
licensee-8.8.3 | lib/licensee/rule.rb |
licensee-8.8.2 | lib/licensee/rule.rb |
licensee-8.8.1 | lib/licensee/rule.rb |
licensee-8.8.0 | lib/licensee/rule.rb |