/usr/share/doc/ruby-innate/examples/provides.rb is in ruby-innate 2013.02.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 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
|