class Copyright
Represents the copyright for an author.
Definitions
def <=>(other)
Compare copyrights by their dates and author.
Signature
-
parameter
otherCopyright The other copyright to compare.
-
returns
Integer The comparison result.
Implementation
def <=> other
self.to_a <=> other.to_a
end
def statement
Generate the copyright statement for the author.
Signature
-
returns
String The formatted copyright statement.
Implementation
def statement
years = self.dates.map(&:year).uniq
period = author.end_with?(".") ? "" : "."
return "Copyright, #{years.join('-')}, by #{author}#{period}"
end