Class: Pubid::Ieee::Transformer
- Inherits:
-
Parslet::Transform
- Object
- Parslet::Transform
- Pubid::Ieee::Transformer
- Defined in:
- lib/pubid/ieee/transformer.rb
Class Method Summary collapse
Class Method Details
.update_month(month) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/pubid/ieee/transformer.rb', line 75 def self.update_month(month) return month if month.is_a?(Integer) # add year when only month digits provided to avoid parsing digits as year Date.parse("1999/#{month}").month end |
.update_month_year(month, year) ⇒ Object
82 83 84 85 |
# File 'lib/pubid/ieee/transformer.rb', line 82 def self.update_month_year(month, year) { year: update_year(year), month: update_month(month) } end |
.update_year(year) ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/pubid/ieee/transformer.rb', line 64 def self.update_year(year) if year.length == 2 case year.to_i when 0..25 then "20#{year}" when 26..99 then "19#{year}" end else year end end |