Sha256: 07b821c8bd6a96eeff98b8ae04182a5777129352d8bb92bc4c8309f2e1feddd4

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

require 'rubygems'
require 'innate'

ARTICLES = {
  'hello' => {
    :author => 'manveru',
    :title => 'Hello, World!',
    :text => 'Some text'
  }
}

class BlogArticles
  Innate.node('/')

  # provide a content representation for requests to /<action>.yaml
  provide(:yaml, :type => 'text/yaml'){|action, value| value.to_yaml }

  # the return value of this method is the `value` in the provide above
  # Since ruby has implicit returns, `ARTICLES` will be the return value.
  #
  # If you request `/list.yaml` you will get the `ARTICLES` object serialized
  # to YAML.
  def list
    @articles = ARTICLES
  end
end

Innate.start

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
manveru-innate-2009.03.24 example/provides.rb
manveru-innate-2009.04.01 example/provides.rb
manveru-innate-2009.04.08 example/provides.rb