Skip to content

Commit

Permalink
render_object/render_collection
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Hollinger <[email protected]>
  • Loading branch information
jhollinger committed Oct 22, 2024
1 parent 9527256 commit 25f7964
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions lib/blueprinter/v2/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ def self.[](name)
children ? view[children] : view
end

def self.render(obj, options = {})
if array_like? obj
render_collection(obj, options)
else
render_object(obj, options)
end
end

def self.render_object(obj, options = {})
# TODO call external renderer
end

def self.render_collection(objs, options = {})
# TODO call external renderer
end

# Apply partials and field exclusions
# @api private
def self.eval!(lock = true)
Expand All @@ -102,9 +118,9 @@ def self.run_eval!
@evaled = true
end

# Render the object
def self.render(obj, options = {})
# TODO: call an external Render module/class, passing in self, obj, and options
# @api private
def self.array_like?(obj)
# TODO
end
end
end
Expand Down

0 comments on commit 25f7964

Please sign in to comment.