Class: Arsenicum::Configuration::InstanceConfiguration
- Inherits:
-
Object
- Object
- Arsenicum::Configuration::InstanceConfiguration
- Includes:
- Util
- Defined in:
- lib/arsenicum/configuration.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.inside ⇒ Object
readonly
Returns the value of attribute inside.
Instance Attribute Summary collapse
-
#init_parameters ⇒ Object
readonly
Returns the value of attribute init_parameters.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #build ⇒ Object
- #init_params(&block) ⇒ Object
-
#initialize(name) ⇒ InstanceConfiguration
constructor
A new instance of InstanceConfiguration.
- #inside ⇒ Object
- #type(type_name) ⇒ Object
Methods included from Util
#camelcase, #classify, #constantize, included, #normalize_hash, #underscore
Constructor Details
#initialize(name) ⇒ InstanceConfiguration
Returns a new instance of InstanceConfiguration.
62 63 64 |
# File 'lib/arsenicum/configuration.rb', line 62 def initialize(name) @name = name end |
Class Attribute Details
.inside ⇒ Object (readonly)
Returns the value of attribute inside.
55 56 57 |
# File 'lib/arsenicum/configuration.rb', line 55 def inside @inside end |
Instance Attribute Details
#init_parameters ⇒ Object (readonly)
Returns the value of attribute init_parameters.
52 53 54 |
# File 'lib/arsenicum/configuration.rb', line 52 def init_parameters @init_parameters end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
52 53 54 |
# File 'lib/arsenicum/configuration.rb', line 52 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
52 53 54 |
# File 'lib/arsenicum/configuration.rb', line 52 def name @name end |
Instance Method Details
#build ⇒ Object
86 87 88 |
# File 'lib/arsenicum/configuration.rb', line 86 def build klass.new(name, init_parameters) end |
#init_params(&block) ⇒ Object
76 77 78 79 80 81 82 83 84 |
# File 'lib/arsenicum/configuration.rb', line 76 def init_params(&block) params = ConfigurationHash.new if block params.under_configuration do params.instance_eval(&block) end end @init_parameters = params end |
#inside ⇒ Object
66 67 68 |
# File 'lib/arsenicum/configuration.rb', line 66 def inside self.class.inside end |
#type(type_name) ⇒ Object
70 71 72 73 74 |
# File 'lib/arsenicum/configuration.rb', line 70 def type(type_name) @klass = constantize(classify(type_name)) rescue NameError @klass = constantize(classify(type_name), inside: inside) end |