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.
227 228 229 |
# File 'lib/config_mapper/config_struct.rb', line 227 def initialize(name) @name = name.to_sym end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
236 237 238 |
# File 'lib/config_mapper/config_struct.rb', line 236 def default @default end |
#description ⇒ Object
Returns the value of attribute description.
234 235 236 |
# File 'lib/config_mapper/config_struct.rb', line 234 def description @description end |
#factory ⇒ Object
Returns the value of attribute factory.
232 233 234 |
# File 'lib/config_mapper/config_struct.rb', line 232 def factory @factory end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
231 232 233 |
# File 'lib/config_mapper/config_struct.rb', line 231 def name @name end |
#required ⇒ Object
Returns the value of attribute required.
237 238 239 |
# File 'lib/config_mapper/config_struct.rb', line 237 def required @required end |
#validator ⇒ Object
Returns the value of attribute validator.
235 236 237 |
# File 'lib/config_mapper/config_struct.rb', line 235 def validator @validator end |
Instance Method Details
#config_doc ⇒ Object
249 250 251 |
# File 'lib/config_mapper/config_struct.rb', line 249 def config_doc self_doc.merge(type_doc) end |
#initial_value ⇒ Object
239 240 241 242 243 |
# File 'lib/config_mapper/config_struct.rb', line 239 def initial_value return factory.new if factory default end |