ratpack 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +26 -13
- data/VERSION +1 -1
- data/lib/sinatra/ratpack.rb +9 -6
- data/ratpack.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -1,18 +1,31 @@
|
|
1
1
|
= ratpack
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
==
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
Common Rails view helpers, rewritten and wrapped up in a gem for use in your Sinatra app.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Install {gemcutter}[http://gemcutter.org] if you haven't already:
|
8
|
+
|
9
|
+
sudo gem install gemcutter
|
10
|
+
gem tumble
|
11
|
+
|
12
|
+
Install the ratpack gem:
|
13
|
+
|
14
|
+
sudo gem install ratpack
|
15
|
+
|
16
|
+
Drop this line in your app:
|
17
|
+
|
18
|
+
require 'sinatra/ratpack'
|
19
|
+
|
20
|
+
== Usage
|
21
|
+
|
22
|
+
See auto-generated documentation at {rdoc.info/projects/zeke/ratpack}[http://rdoc.info/projects/zeke/ratpack]
|
23
|
+
|
24
|
+
== Colophon
|
25
|
+
|
26
|
+
Thanks to the Sinatra page {Writing Extensions}[http://www.sinatrarb.com/extensions.html]
|
27
|
+
Gem built with http://github.com/technicalpickles/jeweler/
|
15
28
|
|
16
29
|
== Copyright
|
17
30
|
|
18
|
-
Copyright (c) 2009 Zeke Sikelianos. See LICENSE for details.
|
31
|
+
Copyright (c) 2009 Zeke Sikelianos. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/sinatra/ratpack.rb
CHANGED
@@ -15,7 +15,6 @@ module Sinatra
|
|
15
15
|
|
16
16
|
# Accepts a single filename or an array of filenames (with or without .css extension)
|
17
17
|
# Assumes stylesheets are in public/stylesheets
|
18
|
-
# TODO: allow for media type to specified
|
19
18
|
def stylesheet_link_tag(string_or_array)
|
20
19
|
files = string_or_array.is_a?(Array) ? string_or_array : [string_or_array]
|
21
20
|
files.map do |file|
|
@@ -24,21 +23,26 @@ module Sinatra
|
|
24
23
|
end.join("\n")
|
25
24
|
end
|
26
25
|
|
27
|
-
|
28
|
-
|
26
|
+
# Accepts a full URL, an image filename, or a path underneath /public/images/
|
27
|
+
def image_tag(src,options={})
|
28
|
+
options[:src] = src.include?("://") ? src : "/images/#{src}"
|
29
29
|
tag(:img, options)
|
30
30
|
end
|
31
|
-
|
32
|
-
|
31
|
+
|
32
|
+
# Works like link_to, but href is optional. If no href supplied, content is used as href
|
33
|
+
def link_to(content,href=nil,options={})
|
34
|
+
href ||= content
|
33
35
|
options.update :href => href
|
34
36
|
content_tag :a, content, options
|
35
37
|
end
|
36
38
|
|
39
|
+
# Just like Rails' content_tag
|
37
40
|
def content_tag(name,content,options={})
|
38
41
|
options = options.map{ |k,v| "#{k}='#{v}'" }.join(" ")
|
39
42
|
"<#{name} #{options}>#{content}</#{name}>"
|
40
43
|
end
|
41
44
|
|
45
|
+
# Just like Rails' tag
|
42
46
|
def tag(name,options={})
|
43
47
|
options = options.map{ |k,v| "#{k}='#{v}'" }.join(" ")
|
44
48
|
"<#{name} #{options} />"
|
@@ -47,7 +51,6 @@ module Sinatra
|
|
47
51
|
# Give this helper an array, and get back a string of <li> elements.
|
48
52
|
# The first item gets a class of first and the last, well.. last.
|
49
53
|
# This makes it easier to apply CSS styles to lists, be they ordered or unordered.
|
50
|
-
# http://zeke.tumblr.com/post/98025647/a-nice-little-view-helper-for-generating-list-items
|
51
54
|
def convert_to_list_items(items)
|
52
55
|
items.inject([]) do |all, item|
|
53
56
|
css = []
|
data/ratpack.gemspec
CHANGED