Sha256: aea68550e6820ccfbff1eaaed0f1568f29d9eab4f6b84d2403c57aae69b85386
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
module LicenseFinder class Dependency < Sequel::Model plugin :boolean_readers many_to_one :license, class: LicenseAlias many_to_one :approval many_to_many :children, join_table: :ancestries, left_key: :parent_dependency_id, right_key: :child_dependency_id, class: self many_to_many :parents, join_table: :ancestries, left_key: :child_dependency_id, right_key: :parent_dependency_id, class: self many_to_many :bundler_groups dataset_module do def bundler exclude(manual: true) end def non_bundler bundler.invert end def obsolete(current) exclude(id: current.map(&:id)) end end def self.unapproved all.reject(&:approved?) end def self.named(name) d = find_or_create(name: name.to_s) d.ensure_approval_exists! d end def approve! approval.state = true approval.save end def approved? (license && license.whitelisted?) || approval.state end def ensure_approval_exists! return if approval self.approval = Approval.create save end end end
Version data entries
4 entries across 4 versions & 1 rubygems