Class: Bake::Modernize::License::Authorship::Copyright

Inherits:
Struct
  • Object
show all
Defined in:
lib/bake/modernize/license.rb

Overview

Represents the copyright for an author.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorObject

Returns the value of attribute author

Returns:

  • (Object)

    the current value of author



201
202
203
# File 'lib/bake/modernize/license.rb', line 201

def author
  @author
end

#datesObject

Returns the value of attribute dates

Returns:

  • (Object)

    the current value of dates



201
202
203
# File 'lib/bake/modernize/license.rb', line 201

def dates
  @dates
end

Instance Method Details

#<=>(other) ⇒ Object

Compare copyrights by their dates and author.



205
206
207
# File 'lib/bake/modernize/license.rb', line 205

def <=> other
	self.to_a <=> other.to_a
end

#statementObject

Generate the copyright statement for the author.



211
212
213
214
215
# File 'lib/bake/modernize/license.rb', line 211

def statement
	years = self.dates.map(&:year).uniq
	period = author.end_with?(".") ? "" : "."
	return "Copyright, #{years.join('-')}, by #{author}#{period}"
end