def render(view_name = nil, context: Attributor::DEFAULT_ROOT_CONTEXT, renderer: Renderer.new, **opts)
      if !view_name.nil?
        warn 'DEPRECATED: please do not pass the view name as the first parameter in Blueprint.render, pass through the view: named param instead.'
      elsif opts.key?(:view)
        view_name = opts[:view]
      end

      fields = opts[:fields]
      view_name = :default if view_name.nil? && fields.nil?

      if view_name
        unless (view = self.class.views[view_name])
          raise "view with name '#{view_name.inspect}' is not defined in #{self.class}"
        end
        return view.render(self, context: context, renderer: renderer)
      end

      # Accept a simple array of fields, and transform it to a 1-level hash with true values
      if fields.is_a? Array
        fields = fields.each_with_object({}) { |field, hash| hash[field] = true }
      end

      # expand fields
      expanded_fields = FieldExpander.expand(self.class, fields)

      renderer.render(self, expanded_fields, context: context)
    end
def render(view_name = nil, context: Attributor::DEFAULT_ROOT_CONTEXT, renderer: Renderer.new, **opts)
      if !view_name.nil?
        warn 'DEPRECATED: please do not pass the view name as the first parameter in Blueprint.render, pass through the view: named param instead.'
      elsif opts.key?(:view)
        view_name = opts[:view]
      end

      fields = opts[:fields]
      view_name = :default if view_name.nil? && fields.nil?

      if view_name
        unless (view = self.class.views[view_name])
          raise "view with name '#{view_name.inspect}' is not defined in #{self.class}"
        end
        return view.render(self, context: context, renderer: renderer)
      end

      # Accept a simple array of fields, and transform it to a 1-level hash with true values
      if fields.is_a? Array
        fields = fields.each_with_object({}) { |field, hash| hash[field] = true }
      end

      # expand fields
      expanded_fields = FieldExpander.expand(self.class, fields)

      renderer.render(self, expanded_fields, context: context)
    end
Render the wrapped data with the given view