rabl 0.0.6 → 0.0.7
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.md +15 -4
- data/lib/rabl/engine.rb +7 -0
- data/lib/rabl/version.rb +1 -1
- metadata +6 -8
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RABL #
|
2
2
|
|
3
|
-
RABL is a ruby templating system for Rails and [Padrino](http://padrinorb.com) that takes a new approach to generating JSON and other formats. Rather than using the ActiveRecord 'to_json', I generally find myself wanting a more expressive and powerful system for generating my APIs. This is especially important when the json representation is complex or doesn't match the exact schema defined in the database itself.
|
3
|
+
RABL (Ruby API Builder Language) is a ruby templating system for Rails and [Padrino](http://padrinorb.com) that takes a new approach to generating JSON and other formats. Rather than using the ActiveRecord 'to_json', I generally find myself wanting a more expressive and powerful system for generating my APIs. This is especially important when the json representation is complex or doesn't match the exact schema defined in the database itself.
|
4
4
|
|
5
5
|
There were a few things in particular I wanted to do easily:
|
6
6
|
|
@@ -75,7 +75,7 @@ You can also add child nodes from an arbitrary source:
|
|
75
75
|
|
76
76
|
or simply use existing model associations:
|
77
77
|
|
78
|
-
# Renders all the 'posts' association
|
78
|
+
# Renders all the 'posts' association
|
79
79
|
# from the model into a node called 'foobar'
|
80
80
|
child :posts => :foobar do
|
81
81
|
attributes :id, :title
|
@@ -143,13 +143,24 @@ Using partials and inheritance can significantly reduce code duplication in your
|
|
143
143
|
|
144
144
|
## Issues ##
|
145
145
|
|
146
|
-
|
147
|
-
|
146
|
+
Check out the [Issues](https://github.com/nesquena/rabl/issues) tab for a full list:
|
147
|
+
|
148
|
+
* I am sloppy and failed to unit test this as I cobbled it together. Don't use it in production until I do, for now this is a fun experiment.
|
149
|
+
* No support for Rails 3 yet, need a Railstie
|
150
|
+
* No configuration options yet for how to create the json (root nodes) :(
|
151
|
+
* Better Tilt template support (precompiling templates)
|
152
|
+
* Benchmarks and performance optimizations
|
153
|
+
* XML Support and potentially others
|
148
154
|
|
149
155
|
## Authors and Contributors ##
|
150
156
|
|
157
|
+
Thanks to [Miso](http://gomiso.com) for allowing me to create this for our applications and release this project!
|
158
|
+
|
151
159
|
* [Nathan Esquenazi](https://github.com/nesquena) - Creator of the project
|
152
160
|
* [Arthur Chiu](https://github.com/achiu) - Core Maintainer, Riot Testing Guru
|
161
|
+
* [Tim Lee](https://github.com/timothy1ee) - RABL is an awesome name and was chosen by the Miso CTO.
|
162
|
+
|
163
|
+
More to come hopefully! Please fork and contribute, any help is appreciated!
|
153
164
|
|
154
165
|
## Inspirations ##
|
155
166
|
|
data/lib/rabl/engine.rb
CHANGED
@@ -99,6 +99,13 @@ module Rabl
|
|
99
99
|
self.class.new(source, :format => "hash", :root => false).render(@_scope, :object => object, &block)
|
100
100
|
end
|
101
101
|
|
102
|
+
# Includes a helper module for RABL
|
103
|
+
# helper ExampleHelper
|
104
|
+
def helper(*klazzes)
|
105
|
+
klazzes.each { |klazz| self.class.send(:include, klazz) }
|
106
|
+
end
|
107
|
+
alias_method :helpers, :helper
|
108
|
+
|
102
109
|
protected
|
103
110
|
|
104
111
|
# Returns a guess at the default object for this template
|
data/lib/rabl/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 17
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Esquenazi
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-04-13 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: riot
|
@@ -80,7 +79,6 @@ files:
|
|
80
79
|
- test/engine_test.rb
|
81
80
|
- test/template_test.rb
|
82
81
|
- test/teststrap.rb
|
83
|
-
has_rdoc: true
|
84
82
|
homepage: https://github.com/nesquena/rabl
|
85
83
|
licenses: []
|
86
84
|
|
@@ -110,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
108
|
requirements: []
|
111
109
|
|
112
110
|
rubyforge_project: rabl
|
113
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.7.2
|
114
112
|
signing_key:
|
115
113
|
specification_version: 3
|
116
114
|
summary: General ruby templating for json or xml
|