representative_view 1.2.0 → 1.2.1
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/Gemfile +2 -0
- data/README.markdown +3 -3
- data/lib/representative_view/action_pack_2_handler.rb +0 -2
- data/lib/representative_view/action_pack_3_handler.rb +0 -2
- data/lib/representative_view/version.rb +1 -1
- data/lib/representative_view/view_helpers.rb +2 -0
- data/spec/representative_view/template_handler_spec.rb +4 -4
- metadata +6 -12
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -6,7 +6,7 @@ Representative View
|
|
6
6
|
Installing it
|
7
7
|
-------------
|
8
8
|
|
9
|
-
Simply add the '`representative_view`' gem to your `Gemfile`
|
9
|
+
Simply add the '`representative_view`' gem to your `Gemfile`
|
10
10
|
|
11
11
|
gem "representative_view"
|
12
12
|
|
@@ -18,14 +18,14 @@ Using it
|
|
18
18
|
In your controller, declare that you can provide both XML and JSON, e.g.
|
19
19
|
|
20
20
|
class BooksController < ApplicationController
|
21
|
-
|
21
|
+
|
22
22
|
def index
|
23
23
|
respond_to do |format|
|
24
24
|
format.xml
|
25
25
|
format.json
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
end
|
30
30
|
|
31
31
|
Next, create a template with the suffix "`.rep`" (to select the Representative View template handler) and use the Representative DSL to generate elements and lists, e.g.
|
@@ -7,8 +7,6 @@ module RepresentativeView
|
|
7
7
|
include ActionView::TemplateHandlers::Compilable
|
8
8
|
|
9
9
|
def compile(template)
|
10
|
-
require 'representative/json'
|
11
|
-
require 'representative/nokogiri'
|
12
10
|
<<-RUBY
|
13
11
|
representative_view(#{template.format.inspect} || template_format) do |r|
|
14
12
|
#{template.source}
|
@@ -15,7 +15,7 @@ describe "a Representative template" do
|
|
15
15
|
|
16
16
|
it "can generate XML" do
|
17
17
|
render("books", :xml, :books => Books.all).should == undent(<<-XML)
|
18
|
-
<?xml version="1.0"?>
|
18
|
+
<?xml version="1.0" encoding="utf-8"?>
|
19
19
|
<books type="array">
|
20
20
|
<book>
|
21
21
|
<title>Sailing for old dogs</title>
|
@@ -33,7 +33,7 @@ describe "a Representative template" do
|
|
33
33
|
it "can generate XML dialects" do
|
34
34
|
Mime::Type.register "application/vnd.books+xml", :book_xml
|
35
35
|
render("books", :book_xml, :books => Books.all).should == undent(<<-XML)
|
36
|
-
<?xml version="1.0"?>
|
36
|
+
<?xml version="1.0" encoding="utf-8"?>
|
37
37
|
<books type="array">
|
38
38
|
<book>
|
39
39
|
<title>Sailing for old dogs</title>
|
@@ -142,7 +142,7 @@ describe "a Representative template" do
|
|
142
142
|
<h2>XML REPRESENTATION</h2>
|
143
143
|
|
144
144
|
<pre>
|
145
|
-
<?xml version="1.0"?>
|
145
|
+
<?xml version="1.0" encoding="utf-8"?>
|
146
146
|
<books type="array">
|
147
147
|
<book>
|
148
148
|
<title>Sailing for old dogs</title>
|
@@ -184,7 +184,7 @@ describe "a Representative template" do
|
|
184
184
|
RepresentativeView.xml_options = {:naming_strategy => :upcase}
|
185
185
|
|
186
186
|
render("books", :xml, :books => Books.all).should == undent(<<-XML)
|
187
|
-
<?xml version="1.0"?>
|
187
|
+
<?xml version="1.0" encoding="utf-8"?>
|
188
188
|
<BOOKS TYPE="array">
|
189
189
|
<BOOK>
|
190
190
|
<TITLE>Sailing for old dogs</TITLE>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: representative_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-02-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: representative
|
16
|
-
requirement: &
|
16
|
+
requirement: &70357628933980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70357628933980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: actionpack
|
27
|
-
requirement: &
|
27
|
+
requirement: &70357628933460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>'
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: 4.0.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *70357628933460
|
39
39
|
description:
|
40
40
|
email: mdub@dogbiscuit.org
|
41
41
|
executables: []
|
@@ -69,18 +69,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- - ! '>='
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
hash: 2640363158941591145
|
75
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
73
|
none: false
|
77
74
|
requirements:
|
78
75
|
- - ! '>='
|
79
76
|
- !ruby/object:Gem::Version
|
80
77
|
version: '0'
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
hash: 2640363158941591145
|
84
78
|
requirements: []
|
85
79
|
rubyforge_project:
|
86
80
|
rubygems_version: 1.8.10
|