lib/rabl/builder.rb in rabl-0.0.2 vs lib/rabl/builder.rb in rabl-0.0.3
- old
+ new
@@ -1,6 +1,6 @@
-module JRB
+module Rabl
class Builder
# Constructs a new ejs hash based on given object and options
def initialize(object, options, &block)
@_object = object
@_result = {}
@@ -72,17 +72,17 @@
object = data_object(data)
glued_attributes = self.object_to_hash(object, &block)
@_result.merge!(glued_attributes)
end
- # Renders a partial hash based on another jrb template
+ # Renders a partial hash based on another rabl template
# partial("users/show", :object => @user)
def partial(file, options={}, &block)
- source = File.read(Rails.root.join("app/views/" + file + ".json.jrb"))
+ source = File.read(Rails.root.join("app/views/" + file + ".json.rabl"))
self.object_to_hash(options[:object], source, &block)
end
- # Extends an existing jrb template with additional attributes in the block
+ # Extends an existing rabl template with additional attributes in the block
# extends("users/show") { attribute :full_name }
def extends(file, options={}, &block)
options = options.merge!(:object => @_object)
result = partial(file, options, &block)
@_result.merge!(result)
\ No newline at end of file