class Licensed::DependencyRecord::License
Attributes
sources[R]
text[R]
Public Class Methods
new(content)
click to toggle source
# File lib/licensed/dependency_record.rb, line 12 def initialize(content) @sources = [] if content.is_a?(String) @text = content.to_s elsif content.respond_to?(:[]) @sources.concat content["sources"].to_s.split(", ") @text = content["text"] end end
Public Instance Methods
key()
click to toggle source
# File lib/licensed/dependency_record.rb, line 31 def key @key ||= begin # rubocop:disable GitHub/InsecureHashAlgorithm sources.join("") + ":" + Digest::XXHash64.digest(text).to_s # rubocop:enable GitHub/InsecureHashAlgorithm end end
to_cache()
click to toggle source
# File lib/licensed/dependency_record.rb, line 23 def to_cache return text if sources.empty? { "sources" => sources.join(", "), "text" => text } end