class Flexparser::FragmentBuilder
Class to build handle turn a given object into a Fragment
. Used mostly as a Safeguard.
Public Class Methods
build(str, namespaces: {})
click to toggle source
@param str [String|Fragment] The object that will be turned into
a Fragment.
@return A fragment of some kind. Either the given fragment, a new
normal {Fragment} or en {EmptyFragment}.
# File lib/flexparser/fragment_builder.rb, line 14 def build(str, namespaces: {}) return str if str.is_a?(Fragment) return EmptyFragment.new(str) if str.nil? Fragment.new(str, namespaces: namespaces) end