class Licensee::Matchers::Gemspec
Constants
- ARRAY_REGEX
an array contains one or more values. all values, or array itself, can be surrounded by any amount of whitespace. do not capture non-value groups
- DECLARATION_REGEX
- LICENSE_ARRAY_REGEX
- LICENSE_REGEX
- VALUE_REGEX
a value is a string surrounded by any amount of whitespace optionally ended with (non-captured) “.freeze”
Private Instance Methods
declarations()
click to toggle source
# File lib/licensee/matchers/gemspec.rb, line 48 def declarations @declarations ||= @file.content.match DECLARATION_REGEX end
license_array_property()
click to toggle source
# File lib/licensee/matchers/gemspec.rb, line 43 def license_array_property match = @file.content.match LICENSE_ARRAY_REGEX match.captures.compact.map(&:downcase) if match end
license_property()
click to toggle source
# File lib/licensee/matchers/gemspec.rb, line 29 def license_property match = @file.content.match LICENSE_REGEX return match[1].downcase if match && match[1] # check for a licenses array property licenses = license_array_property return unless licenses # use 'other' if array contains multiple licenses return 'other' unless licenses.size == 1 licenses[0] end