class Fabricator::Vertical_Peeker::Markup_Constructor
Public Instance Methods
node(type, **attr)
click to toggle source
# File lib/mau/fabricator.rb, line 640 def node type, **attr return push(OpenStruct.new(type: type, **attr)) # [[Array#push]] will return self, allowing [[node]] calls # to be chained. end
plain(data)
click to toggle source
# File lib/mau/fabricator.rb, line 646 def plain data return node(:plain, data: data) end
space(data = nil)
click to toggle source
# File lib/mau/fabricator.rb, line 650 def space data = nil return node(:space, data: data) end
words(s)
click to toggle source
# File lib/mau/fabricator.rb, line 654 def words s s.split(/(\s+)/, -1).each_with_index do |part, i| node(i.even? ? :plain : :space, data: part) end return self end