Class: Blueprinter::Configuration
- Inherits:
-
Object
- Object
- Blueprinter::Configuration
- Defined in:
- lib/blueprinter/configuration.rb
Constant Summary collapse
- VALID_CALLABLES =
%i(if unless).freeze
Instance Attribute Summary collapse
-
#association_default ⇒ Object
Returns the value of attribute association_default.
-
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
-
#field_default ⇒ Object
Returns the value of attribute field_default.
-
#generator ⇒ Object
Returns the value of attribute generator.
-
#if ⇒ Object
Returns the value of attribute if.
-
#method ⇒ Object
Returns the value of attribute method.
-
#sort_fields_by ⇒ Object
Returns the value of attribute sort_fields_by.
-
#unless ⇒ Object
Returns the value of attribute unless.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #jsonify(blob) ⇒ Object
- #valid_callable?(callable_name) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/blueprinter/configuration.rb', line 7 def initialize @association_default = nil @datetime_format = nil @field_default = nil @generator = JSON @if = nil @method = :generate @sort_fields_by = :name_asc @unless = nil end |
Instance Attribute Details
#association_default ⇒ Object
Returns the value of attribute association_default.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def association_default @association_default end |
#datetime_format ⇒ Object
Returns the value of attribute datetime_format.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def datetime_format @datetime_format end |
#field_default ⇒ Object
Returns the value of attribute field_default.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def field_default @field_default end |
#generator ⇒ Object
Returns the value of attribute generator.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def generator @generator end |
#if ⇒ Object
Returns the value of attribute if.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def if @if end |
#method ⇒ Object
Returns the value of attribute method.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def method @method end |
#sort_fields_by ⇒ Object
Returns the value of attribute sort_fields_by.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def sort_fields_by @sort_fields_by end |
#unless ⇒ Object
Returns the value of attribute unless.
3 4 5 |
# File 'lib/blueprinter/configuration.rb', line 3 def unless @unless end |
Instance Method Details
#jsonify(blob) ⇒ Object
18 19 20 |
# File 'lib/blueprinter/configuration.rb', line 18 def jsonify(blob) generator.public_send(method, blob) end |
#valid_callable?(callable_name) ⇒ Boolean
22 23 24 |
# File 'lib/blueprinter/configuration.rb', line 22 def valid_callable?(callable_name) VALID_CALLABLES.include?(callable_name) end |