Class: Virtus::Builder
- Inherits:
-
Object
- Object
- Virtus::Builder
- Defined in:
- lib/virtus/builder.rb,
lib/virtus/builder/hook_context.rb
Overview
Class to build a Virtus module with it’s own config
This allows for individual Virtus modules to be included in classes and not impacted by the global Virtus config, which is implemented using Virtus::config.
Direct Known Subclasses
Defined Under Namespace
Classes: HookContext
Instance Attribute Summary collapse
-
#config ⇒ config
readonly
private
Return config.
-
#mod ⇒ Module
readonly
private
Return module.
Class Method Summary collapse
- .call(options, &block) ⇒ Object private
- .pending ⇒ Object private
Instance Method Summary collapse
- #extensions ⇒ Object private
-
#initialize(conf, mod = Module.new) ⇒ undefined
constructor
private
Initializes a new Builder.
- #options ⇒ Object private
Constructor Details
#initialize(conf, mod = Module.new) ⇒ undefined
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.
Initializes a new Builder
44 45 46 47 48 |
# File 'lib/virtus/builder.rb', line 44 def initialize(conf, mod = Module.new) @config, @mod = conf, mod add_included_hook add_extended_hook end |
Instance Attribute Details
#config ⇒ config (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.
Return config
24 25 26 |
# File 'lib/virtus/builder.rb', line 24 def config @config end |
#mod ⇒ Module (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.
Return module
17 18 19 |
# File 'lib/virtus/builder.rb', line 17 def mod @mod end |
Class Method Details
.call(options, &block) ⇒ 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.
27 28 29 |
# File 'lib/virtus/builder.rb', line 27 def self.call(, &block) new(Configuration.new(, &block)).mod end |
.pending ⇒ 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/virtus/builder.rb', line 32 def self.pending @pending ||= [] end |
Instance Method Details
#extensions ⇒ 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.
51 52 53 |
# File 'lib/virtus/builder.rb', line 51 def extensions [Model::Core] end |
#options ⇒ 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.
56 57 58 |
# File 'lib/virtus/builder.rb', line 56 def config.to_h end |