rabl 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/lib/rabl/builder.rb +2 -2
- data/lib/rabl/engine.rb +2 -2
- data/lib/rabl/template.rb +1 -1
- data/lib/rabl/version.rb +1 -1
- metadata +3 -3
data/lib/rabl/builder.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module JRB
|
2
2
|
class Builder
|
3
|
-
# Constructs a new ejs
|
3
|
+
# Constructs a new ejs hash based on given object and options
|
4
4
|
def initialize(object, options, &block)
|
5
5
|
@_object = object
|
6
6
|
@_result = {}
|
@@ -94,7 +94,7 @@ module JRB
|
|
94
94
|
# Returns a hash based representation of any data object given ejs template block
|
95
95
|
# object_to_hash(@user) { attribute :full_name } => { ... }
|
96
96
|
def object_to_hash(object, source=nil, &block)
|
97
|
-
@options[:
|
97
|
+
@options[:engine].object_to_hash(object, source, &block)
|
98
98
|
end
|
99
99
|
|
100
100
|
# data_object(data) => <AR Object>
|
data/lib/rabl/engine.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module JRB
|
2
2
|
class Engine
|
3
|
-
# Constructs a new ejs
|
3
|
+
# Constructs a new ejs engine based on given vars, handler and declarations
|
4
4
|
def initialize(vars, handler, source_string=nil, &block)
|
5
5
|
@_vars = vars
|
6
6
|
@_handler = handler
|
7
|
-
@_options = { :handler => @_handler, :vars => @_vars, :
|
7
|
+
@_options = { :handler => @_handler, :vars => @_vars, :engine => self }
|
8
8
|
self.copy_instance_variables_from(@_handler, [:@assigns, :@helpers]);
|
9
9
|
@_object = vars[:object] || instance_variable_get("@#{@_handler.controller.controller_name}")
|
10
10
|
instance_eval(source_string) if source_string.present?
|
data/lib/rabl/template.rb
CHANGED
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nathan Esquenazi
|