Sha256: a9fdf31f30b5e6f8f17a862c2dea379254da00ab88564a5c1495870df799526a

Contents?: true

Size: 741 Bytes

Versions: 1

Compression:

Stored size: 741 Bytes

Contents

require 'rubygems'
require 'capcode'
require 'capcode/render/markaby'
require 'graphviz'
$:.unshift( "../lib" )
require 'capcode/render/binary'

module Capcode
  class Index < Route '/'
    def get
      render :markaby => :index
    end
  end
  
  class Image < Route '/image'
    def get
      render :binary => :image, :content_type => "image/png"
    end
  end
end

module Capcode::Views
  def glop
    html do
      body do
        yield
      end
    end
  end
  
  def index
    h1 "Hello !"
    img :src => URL(Capcode::Image)
  end
  
  def image
    GraphViz::new( "G" ) { |g|
      g.hello << g.world
      g.bonjour - g.monde
      g.hola > g.mundo
      g.holla >> g.welt
    }.output( :png => String )
  end
end

Capcode.run( )

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capcode-render-binary-0.1.0 examples/render-binary.rb