Class: LicenseEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_licenselint/license_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_contentObject (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_nameObject (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_nameObject (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_urlObject

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



15
16
17
# File 'lib/ad_licenselint/license_entry.rb', line 15

def copyright
  (/Copyright(.*)$/.match license_content)[0]
end

#is_validObject



11
12
13
# File 'lib/ad_licenselint/license_entry.rb', line 11

def is_valid
  !pod_name.empty? && !license_name.empty?
end

#to_hashObject



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