Class: GitWorkflow::Story::XmlWrapper
- Inherits:
-
Object
- Object
- GitWorkflow::Story::XmlWrapper
- Defined in:
- lib/git_workflow/story.rb
Instance Method Summary collapse
-
#initialize(xml) ⇒ XmlWrapper
constructor
A new instance of XmlWrapper.
- #optional(element) ⇒ Object
- #required!(element) ⇒ Object
Constructor Details
#initialize(xml) ⇒ XmlWrapper
Returns a new instance of XmlWrapper.
70 71 72 |
# File 'lib/git_workflow/story.rb', line 70 def initialize(xml) @xml = Nokogiri::XML(xml) end |
Instance Method Details
#optional(element) ⇒ Object
80 81 82 83 |
# File 'lib/git_workflow/story.rb', line 80 def optional(element) values = @xml.xpath("/story/#{ element }/text()") values.empty? ? nil : values.first.content end |
#required!(element) ⇒ Object
74 75 76 77 78 |
# File 'lib/git_workflow/story.rb', line 74 def required!(element) value = optional(element) raise MissingElement, "Missing '#{ element }' in the PT XML" if value.blank? value end |