Class: Licensed::DependencyRecord::License
- Inherits:
-
Object
- Object
- Licensed::DependencyRecord::License
- Defined in:
- lib/licensed/dependency_record.rb
Instance Attribute Summary collapse
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(content) ⇒ License
constructor
A new instance of License.
- #to_cache ⇒ Object
Constructor Details
#initialize(content) ⇒ License
Returns a new instance of License.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/licensed/dependency_record.rb', line 10 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 |
Instance Attribute Details
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
9 10 11 |
# File 'lib/licensed/dependency_record.rb', line 9 def sources @sources end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
9 10 11 |
# File 'lib/licensed/dependency_record.rb', line 9 def text @text end |
Instance Method Details
#to_cache ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/licensed/dependency_record.rb', line 21 def to_cache return text if sources.empty? { "sources" => sources.join(", "), "text" => text } end |