Sha256: cd2994ea2b9d12bc7db266cc1246f1e4a47ef71423fa8e1a8ada8b79a8fbdfc0
Contents?: true
Size: 943 Bytes
Versions: 9
Compression:
Stored size: 943 Bytes
Contents
require 'genesis_ruby/builders/xml' require 'genesis_ruby/builders/form' require 'genesis_ruby/errors/builder_error' module GenesisRuby # Builder handler class Builder # Builder XML XML = 'xml'.freeze # Builder JSON JSON = 'json'.freeze # Builder FORM FORM = 'form'.freeze # Initialize the Builder Interface based on the Request requirements def initialize(request_interface) case request_interface when XML then @builder_context = Builders::Xml.new when FORM then @builder_context = Builders::Form.new else raise GenesisRuby::BuilderError, 'Invalid Builder interface!' end end # Get built document def document builder_context.output end # Parse tree-structure into Builder document def parse_structure(structure) builder_context.populate_nodes(structure) end private attr_accessor :builder_context end end
Version data entries
9 entries across 9 versions & 1 rubygems