Methods
public class
public instance
Included modules
- XmlContainer
- Enumerable
Attributes
query | [R] | |
states | [R] | |
subpods | [R] |
Public class methods
collection
(xml, options = {})
[show source]
# File lib/wac/pod.rb, line 10 def self.collection(xml, options = {}) Nokogiri::XML(xml.to_s).search('pod').map {|p_xml| new(p_xml, options)} end
new
(xml, options = {})
[show source]
# File lib/wac/pod.rb, line 14 def initialize(xml, options = {}) @query = options[:query] @xml = Nokogiri::XML(xml.to_s).search('pod').first @subpods = Subpod.collection(@xml.search('subpod'), options) @states = State.collection(@xml.search('states'), options) @xml or raise MissingNodeError, "<pod> node missing from xml: #{xml[0..20]}..." types.each {|type| extend type} end
Public instance methods
markup
()
[show source]
# File lib/wac/pod.rb, line 43 def markup @markup ||= (xml.search('markup').text || '') end
plaintext
()
[show source]
# File lib/wac/pod.rb, line 35 def plaintext subpods.detect(&:plaintext).try(:plaintext) end
to_s
()
[show source]
# File lib/wac/pod.rb, line 23 def to_s "#{title}: #{structured? ? plaintext : "'#{markup[0..20]}...'"} #{states.join(", ") if states.any?}" end
types
()
[show source]
# File lib/wac/pod.rb, line 31 def types @types ||= scanner.split(',').map {|type| Wac.mixin(Result, type)} end