Module: ExternalId
- 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_id.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
def self.included(base) base.xml_accessor :id_before_type_cast, :from => “@sourcename” end.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
def self.included(base)
base.xml_accessor :id_before_type_cast, :from => "@sourcename"
end
7 8 9 |
# File 'lib/elibri_onix/external_id.rb', line 7 def self.included(base) base.send(:attr_accessor, :id_before_type_cast) end |
Instance Method Details
#eid ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/elibri_onix/external_id.rb', line 15 def eid begin @id_before_type_cast.split(":")[1].to_i rescue nil end end |
#id ⇒ Object
23 24 25 26 |
# File 'lib/elibri_onix/external_id.rb', line 23 def id Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead." eid end |
#set_eid(data) ⇒ Object
11 12 13 |
# File 'lib/elibri_onix/external_id.rb', line 11 def set_eid(data) @id_before_type_cast = data.attr('sourcename') end |