Class: TitlePage::Title
Instance Attribute Summary collapse
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#title_prefix ⇒ Object
Returns the value of attribute title_prefix.
-
#title_text ⇒ Object
Returns the value of attribute title_text.
-
#title_type ⇒ Object
Returns the value of attribute title_type.
-
#title_without_prefix ⇒ Object
Returns the value of attribute title_without_prefix.
Class Method Summary collapse
-
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::Title object.
Instance Attribute Details
#subtitle ⇒ Object
Returns the value of attribute subtitle.
47 48 49 |
# File 'lib/titlepage/utils.rb', line 47 def subtitle @subtitle end |
#title_prefix ⇒ Object
Returns the value of attribute title_prefix.
45 46 47 |
# File 'lib/titlepage/utils.rb', line 45 def title_prefix @title_prefix end |
#title_text ⇒ Object
Returns the value of attribute title_text.
44 45 46 |
# File 'lib/titlepage/utils.rb', line 44 def title_text @title_text end |
#title_type ⇒ Object
Returns the value of attribute title_type.
43 44 45 |
# File 'lib/titlepage/utils.rb', line 43 def title_type @title_type end |
#title_without_prefix ⇒ Object
Returns the value of attribute title_without_prefix.
46 47 48 |
# File 'lib/titlepage/utils.rb', line 46 def title_without_prefix @title_without_prefix end |
Class Method Details
.from_xml(node) ⇒ Object
convert a nokogiri node to a TitlePage::Title object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/titlepage/utils.rb', line 51 def self.from_xml(node) return nil if node.nil? #<Title xsi:type="tns:Title"> # <TitleType xsi:type="xsd:string">01</TitleType> # <TitleText xsi:type="xsd:string">Fight Club</TitleText> #</Title> title = self.new title.title_type = node.xpath("//Title/TitleType/text()").first.andand.to_s title.title_text = node.xpath("//Title/TitleText/text()").first.andand.to_s title.title_prefix = node.xpath("//Title/TitlePrefix/text()").first.andand.to_s title.title_without_prefix = node.xpath("//Title/TitleWithoutPrefix/text()").first.andand.to_s title.subtitle = node.xpath("//Title/Subtitle/text()").first.andand.to_s title end |