class Licensee::Project::File

Attributes

content[R]
filename[R]
path[R]

Public Class Methods

new(content, filename = nil) click to toggle source
# File lib/licensee/project_file.rb, line 6
def initialize(content, filename = nil)
  @content = content
  options = { invalid: :replace, undef: :replace, replace: '' }
  @content.encode!(Encoding::UTF_8, options)
  @filename = filename
end

Public Instance Methods

confidence() click to toggle source

Returns the percent confident with the match

# File lib/licensee/project_file.rb, line 18
def confidence
  matcher && matcher.confidence
end
license() click to toggle source
# File lib/licensee/project_file.rb, line 22
def license
  matcher && matcher.match
end
Also aliased as: match
match()
Alias for: license
matcher() click to toggle source
# File lib/licensee/project_file.rb, line 13
def matcher
  @matcher ||= possible_matchers.map { |m| m.new(self) }.find(&:match)
end