Sha256: 429e70fe4f7da401e55e7964f8c4a2a1e7abf33c980cb728736afa37269e876f

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

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

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

2 entries across 2 versions & 1 rubygems

Version Path
Capcode-0.8.9 examples/render-binary.rb
Capcode-0.8.8 examples/render-binary.rb