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
Constant Summary collapse
- ATTRIBUTES =
:nodoc:
[ :type, :author, :source_title, :text, :source_url, :type_name ]
- RELATIONS =
:nodoc:
[ :inspect_include_fields ]
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.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 26 def initialize(data) @to_xml = data.to_s @type = data.at_xpath('xmlns:TextType').try(:text) @author = data.at_xpath('xmlns:TextAuthor').try(:text) @source_title = data.at_xpath('xmlns:SourceTitle').try(:text) if data.at_xpath('xmlns:Text') @text = data.at_xpath('xmlns:Text').children.find { |x| x.cdata? }.try(:text) #cdata => true ? @source_url = data.at_xpath('xmlns:Text').attribute('sourcename').try(:text) end set_eid(data) set_datestamp(data) end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def @author end |
#source_title ⇒ Object
Returns the value of attribute source_title.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def source_title @source_title end |
#source_url ⇒ Object
Returns the value of attribute source_url.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def source_url @source_url end |
#text ⇒ Object
Returns the value of attribute text.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def text @text end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
24 25 26 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 24 def type @type end |
Instance Method Details
#inspect_include_fields ⇒ Object
44 45 46 |
# File 'lib/elibri_onix/onix_3_0/text_content.rb', line 44 def inspect_include_fields [:type_name, :text] end |