Class: Blueprinter::View Private
- Inherits:
-
Object
- Object
- Blueprinter::View
- Defined in:
- lib/blueprinter/view.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.
Instance Attribute Summary collapse
- #excluded_field_names ⇒ Object readonly private
- #fields ⇒ Object readonly private
- #included_view_names ⇒ Object readonly private
- #name ⇒ Object readonly private
Instance Method Summary collapse
- #<<(field) ⇒ Object private
- #exclude_field(field_name) ⇒ Object private
- #include_view(view_name) ⇒ Object private
-
#initialize(name, fields: {}, included_view_names: [], excluded_view_names: []) ⇒ View
constructor
private
A new instance of View.
Constructor Details
#initialize(name, fields: {}, included_view_names: [], excluded_view_names: []) ⇒ 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 new instance of View.
6 7 8 9 10 11 |
# File 'lib/blueprinter/view.rb', line 6 def initialize(name, fields: {}, included_view_names: [], excluded_view_names: []) @name = name @fields = fields @included_view_names = included_view_names @excluded_field_names = excluded_view_names end |
Instance Attribute Details
#excluded_field_names ⇒ Object (readonly)
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.
4 5 6 |
# File 'lib/blueprinter/view.rb', line 4 def excluded_field_names @excluded_field_names end |
#fields ⇒ Object (readonly)
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.
4 5 6 |
# File 'lib/blueprinter/view.rb', line 4 def fields @fields end |
#included_view_names ⇒ Object (readonly)
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.
4 5 6 |
# File 'lib/blueprinter/view.rb', line 4 def included_view_names @included_view_names end |
#name ⇒ Object (readonly)
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.
4 5 6 |
# File 'lib/blueprinter/view.rb', line 4 def name @name end |
Instance Method Details
#<<(field) ⇒ 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.
21 22 23 24 25 26 27 |
# File 'lib/blueprinter/view.rb', line 21 def <<(field) if fields.has_key?(field.name) raise BlueprinterError, "Field #{field.name} already defined on #{name}" end fields[field.name] = field end |
#exclude_field(field_name) ⇒ 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.
17 18 19 |
# File 'lib/blueprinter/view.rb', line 17 def exclude_field(field_name) excluded_field_names << field_name end |
#include_view(view_name) ⇒ 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.
13 14 15 |
# File 'lib/blueprinter/view.rb', line 13 def include_view(view_name) included_view_names << view_name end |