Harbor Documentation

Harbor::XMLView

Parent

Attributes

  • xml [RW] (Not documented)
  • output [RW] (Not documented)

Public Class Methods

new(view, context = {})

      # File lib/harbor/xml_view.rb, line 27
27:     def initialize(view, context = {})
28:       super
29:       @content_type = "text/xml"
30:       @extension = ".rxml"
31:       @output = ""
32:       @filename = ::File.extname(view) == "" ? (view + @extension) : view
33: 
34:       if context.is_a?(ViewContext)
35:         @context = context
36:         @xml = context.view.xml
37:       else
38:         @xml = Builder::XmlMarkup.new(:indent => 2, :target => @output)
39:         @context = XMLViewContext.new(self, context)
40:       end
41:     end

Public Instance Methods

supports_layouts?()

      # File lib/harbor/xml_view.rb, line 43
43:     def supports_layouts?
44:       false
45:     end

to_s(layout = nil)

      # File lib/harbor/xml_view.rb, line 47
47:     def to_s(layout = nil)
48:       path = View::path.detect { |dir| ::File.exists?(dir + @filename) }
49:       raise "Could not find '#{@filename}' in #{View::path.inspect}" if path.nil?
50:       
51:       eval_code = ::File.read(path + @filename)
52:       XMLViewContext.new(self, @context).instance_eval(eval_code, __FILE__, __LINE__)
53: 
54:       @output
55:     end