Class: Virtus::Builder::HookContext
- Inherits:
-
Object
- Object
- Virtus::Builder::HookContext
- Defined in:
- lib/virtus/builder/hook_context.rb
Overview
Context used for building “included” and “extended” hooks
Instance Attribute Summary collapse
- #attribute_method ⇒ Object readonly
- #builder ⇒ Object readonly
- #config ⇒ Object readonly
Instance Method Summary collapse
- #constructor? ⇒ Boolean private
- #finalize? ⇒ Boolean private
-
#initialize(builder, config) ⇒ HookContext
constructor
private
A new instance of HookContext.
- #initialize_attribute_method ⇒ Object private
- #mass_assignment? ⇒ Boolean private
- #modules ⇒ Object private
Constructor Details
#initialize(builder, config) ⇒ HookContext
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 HookContext.
11 12 13 14 |
# File 'lib/virtus/builder/hook_context.rb', line 11 def initialize(builder, config) @builder, @config = builder, config initialize_attribute_method end |
Instance Attribute Details
#attribute_method ⇒ Object (readonly)
8 9 10 |
# File 'lib/virtus/builder/hook_context.rb', line 8 def attribute_method @attribute_method end |
#builder ⇒ Object (readonly)
8 9 10 |
# File 'lib/virtus/builder/hook_context.rb', line 8 def builder @builder end |
#config ⇒ Object (readonly)
8 9 10 |
# File 'lib/virtus/builder/hook_context.rb', line 8 def config @config end |
Instance Method Details
#constructor? ⇒ 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.
25 26 27 |
# File 'lib/virtus/builder/hook_context.rb', line 25 def constructor? config.constructor end |
#finalize? ⇒ 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.
35 36 37 |
# File 'lib/virtus/builder/hook_context.rb', line 35 def finalize? config.finalize end |
#initialize_attribute_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.
40 41 42 43 44 45 46 |
# File 'lib/virtus/builder/hook_context.rb', line 40 def initialize_attribute_method = builder. @attribute_method = lambda do |name, type = nil, = {}| super(name, type, .merge()) end end |
#mass_assignment? ⇒ 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.
30 31 32 |
# File 'lib/virtus/builder/hook_context.rb', line 30 def mass_assignment? config.mass_assignment end |
#modules ⇒ 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 20 21 22 |
# File 'lib/virtus/builder/hook_context.rb', line 17 def modules modules = builder.extensions modules << Model::Constructor if constructor? modules << Model::MassAssignment if mass_assignment? modules end |