Sha256: 27094c02b95c1914d02e4c8410f05da9d4337e8143be87c635f628579d2f8c7b

Contents?: true

Size: 770 Bytes

Versions: 31

Compression:

Stored size: 770 Bytes

Contents

require 'rubygems'
require 'innate'
require 'yaml'

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

class BlogArticles
  Innate.node('/')

  # provide a content representation for requests to /<action>.yaml
  # If you request `/list.yaml`, you will get the `ARTICLES object serialized
  # to YAML.
  provide(:yaml, :type => 'text/yaml'){|action, value| value.to_yaml }

  # Since there will always be an `html` representation (the default), you have
  # to take care of it. If you simply want to return an empty page, use following.
  provide(:html){|action, value| '' }

  # The return value of this method is the `value` in the provides above.
  def list
    return ARTICLES
  end
end

Innate.start

Version data entries

31 entries across 31 versions & 3 rubygems

Version Path
innate-2023.01.06 example/provides.rb
innate-2015.10.28 example/provides.rb
manveru-innate-2009.04.18 example/provides.rb
manveru-innate-2009.04 example/provides.rb
manveru-innate-2009.05 example/provides.rb
manveru-innate-2009.06.12 example/provides.rb
manveru-innate-2009.06 example/provides.rb
manveru-innate-2009.07 example/provides.rb
rjspotter-innate-2009.06.29 example/provides.rb
rjspotter-innate-2009.06.30 example/provides.rb
rjspotter-innate-2009.06.31 example/provides.rb
innate-2013.02.21 example/provides.rb
innate-2013.02 example/provides.rb
innate-2012.12 example/provides.rb
innate-2012.03 example/provides.rb
innate-2011.12 example/provides.rb
innate-2011.10 example/provides.rb
innate-2011.04 example/provides.rb
innate-2011.01 example/provides.rb
innate-2010.07 example/provides.rb