Module: Redmine::Views::Builders

Defined in:
lib/redmine/views/builders.rb,
lib/redmine/views/builders/xml.rb,
lib/redmine/views/builders/json.rb,
lib/redmine/views/builders/structure.rb

Defined Under Namespace

Classes: Json, Structure, Xml

Class Method Summary collapse

Class Method Details

.for(format, &block) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/redmine/views/builders.rb', line 18

def self.for(format, &block)
  builder = case format
    when 'xml',  :xml;  Builders::Xml.new
    when 'json', :json; Builders::Json.new
    else; raise "No builder for format #{format}"
  end
  if block
    block.call(builder)
  else
    builder
  end
end