Class: ConfigMapper::ConfigStruct::Attribute
- Inherits:
-
Object
- Object
- ConfigMapper::ConfigStruct::Attribute
- Defined in:
- lib/config_mapper/config_struct.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#description ⇒ Object
Returns the value of attribute description.
-
#factory ⇒ Object
Returns the value of attribute factory.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#required ⇒ Object
Returns the value of attribute required.
-
#validator ⇒ Object
Returns the value of attribute validator.
Instance Method Summary collapse
- #config_doc ⇒ Object
- #initial_value ⇒ Object
-
#initialize(name) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name) ⇒ Attribute
Returns a new instance of Attribute.
197 198 199 |
# File 'lib/config_mapper/config_struct.rb', line 197 def initialize(name) @name = name.to_sym end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
206 207 208 |
# File 'lib/config_mapper/config_struct.rb', line 206 def default @default end |
#description ⇒ Object
Returns the value of attribute description.
203 204 205 |
# File 'lib/config_mapper/config_struct.rb', line 203 def description @description end |
#factory ⇒ Object
Returns the value of attribute factory.
204 205 206 |
# File 'lib/config_mapper/config_struct.rb', line 204 def factory @factory end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
201 202 203 |
# File 'lib/config_mapper/config_struct.rb', line 201 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
207 208 209 |
# File 'lib/config_mapper/config_struct.rb', line 207 def required @required end |
#validator ⇒ Object
Returns the value of attribute validator.
205 206 207 |
# File 'lib/config_mapper/config_struct.rb', line 205 def validator @validator end |
Instance Method Details
#config_doc ⇒ Object
218 219 220 |
# File 'lib/config_mapper/config_struct.rb', line 218 def config_doc self_doc.merge(type_doc) end |
#initial_value ⇒ Object
209 210 211 212 |
# File 'lib/config_mapper/config_struct.rb', line 209 def initial_value return factory.new if factory default end |