Module: ExternalTimestamp
- Included in:
- Elibri::ONIX::Release_3_0::Contributor, Elibri::ONIX::Release_3_0::SupportingResource, Elibri::ONIX::Release_3_0::TextContent
- Defined in:
- lib/elibri_onix/external_timestamp.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 |
# File 'lib/elibri_onix/external_timestamp.rb', line 3 def self.included(base) base.send(:attr_accessor, :datestamp_before_type_cast) #, :from => "@datestamp" end |
Instance Method Details
#datestamp ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/elibri_onix/external_timestamp.rb', line 11 def datestamp year = datestamp_before_type_cast[0...4].to_i month = datestamp_before_type_cast[4...6].to_i day = datestamp_before_type_cast[6...8].to_i h = datestamp_before_type_cast[9...11].to_i m = datestamp_before_type_cast[11...13].to_i Date.new(year, month, day) + h.hours + m.minutes end |
#set_datestamp(data) ⇒ Object
7 8 9 |
# File 'lib/elibri_onix/external_timestamp.rb', line 7 def set_datestamp(data) @datestamp_before_type_cast = data.attr('datestamp') end |