Class: LicenseFinder::Dependency
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- LicenseFinder::Dependency
- Defined in:
- lib/license_finder/tables/dependency.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apply_better_license(license_name) ⇒ Object
- #approve! ⇒ Object
- #approved? ⇒ Boolean
- #bundler_group_names=(names) ⇒ Object
- #children_names=(names) ⇒ Object
- #set_license_manually!(license_name) ⇒ Object
Class Method Details
.named(name) ⇒ Object
27 28 29 |
# File 'lib/license_finder/tables/dependency.rb', line 27 def self.named(name) find_or_create(name: name.to_s) end |
.unapproved ⇒ Object
23 24 25 |
# File 'lib/license_finder/tables/dependency.rb', line 23 def self.unapproved all.reject(&:approved?) end |
Instance Method Details
#apply_better_license(license_name) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/license_finder/tables/dependency.rb', line 54 def apply_better_license(license_name) return if license_manual if license.nil? || license.name != license_name self.license = LicenseAlias.named(license_name) end end |
#approve! ⇒ Object
39 40 41 42 |
# File 'lib/license_finder/tables/dependency.rb', line 39 def approve! self.manually_approved = true save end |
#approved? ⇒ Boolean
44 45 46 |
# File 'lib/license_finder/tables/dependency.rb', line 44 def approved? (license && license.whitelisted?) || manually_approved? end |
#bundler_group_names=(names) ⇒ Object
31 32 33 |
# File 'lib/license_finder/tables/dependency.rb', line 31 def bundler_group_names=(names) update_association_collection(:bundler_groups, names) end |
#children_names=(names) ⇒ Object
35 36 37 |
# File 'lib/license_finder/tables/dependency.rb', line 35 def children_names=(names) update_association_collection(:children, names) end |
#set_license_manually!(license_name) ⇒ Object
48 49 50 51 52 |
# File 'lib/license_finder/tables/dependency.rb', line 48 def set_license_manually!(license_name) self.license = LicenseAlias.named(license_name) self.license_manual = true save end |