Class: LicenseScout::License::Record
- Inherits:
-
Object
- Object
- LicenseScout::License::Record
- Defined in:
- lib/license_scout/license.rb
Overview
A class that represents the components that make up a license.
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parsed_expression ⇒ Object
readonly
Returns the value of attribute parsed_expression.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#spdx_license_data ⇒ Object
readonly
Returns the value of attribute spdx_license_data.
Instance Method Summary collapse
-
#initialize(license_id = nil, source = nil, content = nil, options = {}) ⇒ Record
constructor
A new instance of Record.
- #to_h ⇒ Object
Constructor Details
#initialize(license_id = nil, source = nil, content = nil, options = {}) ⇒ Record
Returns a new instance of Record.
30 31 32 33 34 35 |
# File 'lib/license_scout/license.rb', line 30 def initialize(license_id = nil, source = nil, content = nil, = {}) @id = LicenseScout::SPDX.find(license_id, [:force]) @parsed_expression = LicenseScout::SPDX.parse(id) @source = source @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
27 28 29 |
# File 'lib/license_scout/license.rb', line 27 def content @content end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
24 25 26 |
# File 'lib/license_scout/license.rb', line 24 def id @id end |
#parsed_expression ⇒ Object (readonly)
Returns the value of attribute parsed_expression.
25 26 27 |
# File 'lib/license_scout/license.rb', line 25 def parsed_expression @parsed_expression end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
26 27 28 |
# File 'lib/license_scout/license.rb', line 26 def source @source end |
#spdx_license_data ⇒ Object (readonly)
Returns the value of attribute spdx_license_data.
28 29 30 |
# File 'lib/license_scout/license.rb', line 28 def spdx_license_data @spdx_license_data end |
Instance Method Details
#to_h ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/license_scout/license.rb', line 37 def to_h { id: id, source: source, content: content, } end |