class StyleGuideAPI::MiddlemanExtension
Public Class Methods
new(app, options_hash = {}, &block)
click to toggle source
Calls superclass method
# File lib/styleguide-api/middleman.rb, line 6 def initialize(app, options_hash = {}, &block) super app.configure :development do StyleGuideAPI.live = true end if options_hash.has_key?(:templates) StyleGuideAPI.add_templates options_hash[:templates] end if options_hash.has_key?(:load) StyleGuideAPI.load options_hash[:load] end if options_hash.has_key?(:theme) StyleGuideAPI.theme = options_hash[:theme] end end
Public Instance Methods
style_template(name, locals = {}, &block)
click to toggle source
# File lib/styleguide-api/middleman.rb, line 29 def style_template(name, locals = {}, &block) locals[:scope] = self if block_given? template = StyleGuideAPI.data[StyleGuideAPI.theme]["templates"][name] type = template["type"].to_sym handler_class = ::Padrino::Helpers::OutputHelpers.handlers[type] html = handler_class.new(self).capture_from_template(&block) block = Proc.new { html } end StyleGuideAPI::render(name, locals, &block) end