Module: Blueprinter::Reflection Private

Included in:
Base
Defined in:
lib/blueprinter/reflection.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Public methods for reflecting on a Blueprint.

Defined Under Namespace

Classes: Association, Field, View

Instance Method Summary collapse

Instance Method Details

#reflectionsHash<Symbol, Blueprinter::Reflection::View>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a Hash of views keyed by name.

Example:

widget_view = WidgetBlueprint.reflections[:default]
category = widget_view.associations[:category]
category.blueprint
=> CategoryBlueprint
category.view
=> :default

Returns:



25
26
27
28
29
# File 'lib/blueprinter/reflection.rb', line 25

def reflections
  @reflections ||= view_collection.views.transform_values do |view|
    View.new(view.name, view_collection)
  end
end