Class: LicenseFinder::AndLicense

Inherits:
License
  • Object
show all
Defined in:
lib/license_finder/license.rb

Direct Known Subclasses

OrLicense

Instance Attribute Summary collapse

Attributes inherited from License

#url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from License

all, #eql?, find_by_name, find_by_text, #hash, #matches_name?, #matches_text?, #name, #stripped_name, #unrecognized_matcher?

Constructor Details

#initialize(name, operator = AndLicense.operator) ⇒ AndLicense

Returns a new instance of AndLicense.



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/license_finder/license.rb', line 92

def initialize(name, operator = AndLicense.operator)
  @short_name = name
  @pretty_name = name
  @url = nil
  @matcher = NoneMatcher.new
  # removes heading and trailing parentesis and splits
  name = name[1..-2] if name.start_with?('(')
  names = name.split(operator)
  @sub_licenses = names.map do |sub_name|
    License.find_by_name(sub_name)
  end
end

Instance Attribute Details

#sub_licensesObject (readonly)

Returns the value of attribute sub_licenses.



105
106
107
# File 'lib/license_finder/license.rb', line 105

def sub_licenses
  @sub_licenses
end

Class Method Details

.operatorObject



88
89
90
# File 'lib/license_finder/license.rb', line 88

def self.operator
  ' AND '
end