Module: CopyrightHelper
- Defined in:
- lib/copyright_helper.rb
Overview
Adds a method for copyright period
Instance Method Summary collapse
-
#copyright_years(since) ⇒ Object
Returns copyright period in years.
Instance Method Details
#copyright_years(since) ⇒ Object
Returns copyright period in years
12 13 14 15 16 17 18 19 20 |
# File 'lib/copyright_helper.rb', line 12 def copyright_years(since) raise ArgumentError, "Argument should be a number" unless since.is_a?(Integer) raise ArgumentError, "since should not be a future" if since > Time.new.year if since == Time.new.year "#{since}" else "#{since}-#{Time.new.year}" end end |