Class: Blueprinter::Configuration Private
- Inherits:
-
Object
- Object
- Blueprinter::Configuration
- Defined in:
- lib/blueprinter/configuration.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- VALID_CALLABLES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
i(if unless).freeze
Instance Attribute Summary collapse
- #association_default ⇒ Object private
- #custom_array_like_classes ⇒ Object private
- #datetime_format ⇒ Object private
- #default_transformers ⇒ Object private
- #deprecations ⇒ Object private
- #extractor_default ⇒ Object private
- #field_default ⇒ Object private
- #generator ⇒ Object private
- #if ⇒ Object private
- #method ⇒ Object private
- #sort_fields_by ⇒ Object private
- #unless ⇒ Object private
Instance Method Summary collapse
- #array_like_classes ⇒ Object private
-
#initialize ⇒ Configuration
constructor
private
A new instance of Configuration.
- #jsonify(blob) ⇒ Object private
- #valid_callable?(callable_name) ⇒ Boolean private
Constructor Details
#initialize ⇒ Configuration
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 new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/blueprinter/configuration.rb', line 9 def initialize @deprecations = :stderror @association_default = nil @datetime_format = nil @field_default = nil @generator = JSON @if = nil @method = :generate @sort_fields_by = :name_asc @unless = nil @extractor_default = AutoExtractor @default_transformers = [] @custom_array_like_classes = [] end |
Instance Attribute Details
#association_default ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def association_default @association_default end |
#custom_array_like_classes ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def custom_array_like_classes @custom_array_like_classes end |
#datetime_format ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def datetime_format @datetime_format end |
#default_transformers ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def default_transformers @default_transformers end |
#deprecations ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def deprecations @deprecations end |
#extractor_default ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def extractor_default @extractor_default end |
#field_default ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def field_default @field_default end |
#generator ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def generator @generator end |
#if ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def if @if end |
#method ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def method @method end |
#sort_fields_by ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def sort_fields_by @sort_fields_by end |
#unless ⇒ Object
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.
5 6 7 |
# File 'lib/blueprinter/configuration.rb', line 5 def unless @unless end |
Instance Method Details
#array_like_classes ⇒ Object
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.
24 25 26 27 28 29 30 |
# File 'lib/blueprinter/configuration.rb', line 24 def array_like_classes @array_like_classes ||= [ Array, defined?(ActiveRecord::Relation) && ActiveRecord::Relation, *custom_array_like_classes ].compact end |
#jsonify(blob) ⇒ Object
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.
32 33 34 |
# File 'lib/blueprinter/configuration.rb', line 32 def jsonify(blob) generator.public_send(method, blob) end |
#valid_callable?(callable_name) ⇒ Boolean
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.
36 37 38 |
# File 'lib/blueprinter/configuration.rb', line 36 def valid_callable?(callable_name) VALID_CALLABLES.include?(callable_name) end |