Sha256: 17952c1a3fa886a50845fd88cdca2774a942710c205c67fe15b95a7fecd4928d

Contents?: true

Size: 802 Bytes

Versions: 3

Compression:

Stored size: 802 Bytes

Contents

require 'bundler/setup'

require 'rubygems'

require 'action_view'
require 'sinatra'
require 'green_monkey'
require 'ostruct'


get '/' do
  @post = OpenStruct.new(
    html_schema_type: Mida(:BlogPosting),
    id: 5, 
    title: 'Hello world', 
    body: 'Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort',
    created_at: Time.parse('10-feb-2012')
  )
  erb :index
end

__END__

@@ index
<DOCTYPE html>
<html>
  <head></head>
  <body>
    <article <%= mida_scope(@post) %>>
      <a href="/posts/<%= @post.id%>" itemprop="url">
        <h3 itemprop="name"><%= @post.title %></h3>
      </a>

      <div class="post_body" itemprop="articleBody"><%= @post.body %></div>
      <%= time_tag @post.created_at, itemprop: 'datePublished' %>
    </article>
  </body>
</html>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
green_monkey-0.3.0 sinatra_app/app.rb
green_monkey-0.2.2 sinatra_app/app.rb
green_monkey-0.1.4 sinatra_app/app.rb