Method: Riddler.render

Defined in:
lib/riddler.rb

.render(content_definition, context = {}) ⇒ Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/riddler.rb', line 51

def self.render content_definition, context={}
  unless context.kind_of? ::Riddler::Context
    director = ::Riddler::ContextDirector.new context
    context = director.context
  end

  case content_definition["content_type"]
  when "element"
    content = ::Riddler::Element.for content_definition, context
  when "step"
    content = ::Riddler::Step.for content_definition, context
  end

  return nil unless content.include?

  content.to_hash
end