Class: Elibri::ONIX::Release_3_0::TextContent
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::TextContent
- Includes:
- ExternalId, ExternalTimestamp, Inspector
- Defined in:
- lib/elibri_onix/onix_3_0/text_content.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#source_title ⇒ Object
Returns the value of attribute source_title.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
-
#text ⇒ Object
Returns the value of attribute text.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(data) ⇒ TextContent
constructor
A new instance of TextContent.
- #inspect_include_fields ⇒ Object
- #type_name ⇒ Object
Methods included from Inspector
#attribute_for_inspect, #inspect
Methods included from ExternalTimestamp
#datestamp, included, #set_datestamp
Methods included from ExternalId
Constructor Details
#initialize(data) ⇒ TextContent
Returns a new instance of TextContent.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 11 def initialize(data) @to_xml = data.to_s @type = data.at_css('TextType')&.text @author = data.at_css('TextAuthor')&.text @source_title = data.at_css('SourceTitle')&.text if data.at_css('Text') @text = data.at_css('Text').children.find { |x| x.cdata? }&.text #cdata => true ? @source_url = data.at_css('Text').attribute('sourcename')&.text end set_eid(data) set_datestamp(data) end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def @author end |
#source_title ⇒ Object
Returns the value of attribute source_title.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def source_title @source_title end |
#source_url ⇒ Object
Returns the value of attribute source_url.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def source_url @source_url end |
#text ⇒ Object
Returns the value of attribute text.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def text @text end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 9 def type @type end |
Instance Method Details
#inspect_include_fields ⇒ Object
29 30 31 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 29 def inspect_include_fields [:type_name, :text] end |