Class: LicenseEntry
- Inherits:
-
Object
- Object
- LicenseEntry
- Defined in:
- lib/ad_licenselint/license_entry.rb
Instance Attribute Summary collapse
-
#license_content ⇒ Object
readonly
Returns the value of attribute license_content.
-
#license_name ⇒ Object
readonly
Returns the value of attribute license_name.
-
#pod_name ⇒ Object
readonly
Returns the value of attribute pod_name.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
Instance Method Summary collapse
- #copyright ⇒ Object
-
#initialize(hash) ⇒ LicenseEntry
constructor
A new instance of LicenseEntry.
- #is_valid ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(hash) ⇒ LicenseEntry
Returns a new instance of LicenseEntry.
5 6 7 8 9 |
# File 'lib/ad_licenselint/license_entry.rb', line 5 def initialize(hash) @pod_name = hash["Title"] || "" @license_name = hash["License"] || "" @license_content = hash["FooterText"] || "" end |
Instance Attribute Details
#license_content ⇒ Object (readonly)
Returns the value of attribute license_content.
2 3 4 |
# File 'lib/ad_licenselint/license_entry.rb', line 2 def license_content @license_content end |
#license_name ⇒ Object (readonly)
Returns the value of attribute license_name.
2 3 4 |
# File 'lib/ad_licenselint/license_entry.rb', line 2 def license_name @license_name end |
#pod_name ⇒ Object (readonly)
Returns the value of attribute pod_name.
2 3 4 |
# File 'lib/ad_licenselint/license_entry.rb', line 2 def pod_name @pod_name end |
#source_url ⇒ Object
Returns the value of attribute source_url.
2 3 4 |
# File 'lib/ad_licenselint/license_entry.rb', line 2 def source_url @source_url end |
Instance Method Details
#copyright ⇒ Object
15 16 17 |
# File 'lib/ad_licenselint/license_entry.rb', line 15 def copyright (/Copyright(.*)$/.match license_content)[0] end |
#is_valid ⇒ Object
11 12 13 |
# File 'lib/ad_licenselint/license_entry.rb', line 11 def is_valid !pod_name.empty? && !license_name.empty? end |
#to_hash ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/ad_licenselint/license_entry.rb', line 19 def to_hash { pod_name: @pod_name, license_content: @license_content, license_name: @license_name, source_url: @source_url } end |