Class: ConfigMapper::ConfigStruct::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/config_mapper/config_struct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Attribute

Returns a new instance of Attribute.



210
211
212
# File 'lib/config_mapper/config_struct.rb', line 210

def initialize(name)
  @name = name.to_sym
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



219
220
221
# File 'lib/config_mapper/config_struct.rb', line 219

def default
  @default
end

#descriptionObject

Returns the value of attribute description.



216
217
218
# File 'lib/config_mapper/config_struct.rb', line 216

def description
  @description
end

#factoryObject

Returns the value of attribute factory.



217
218
219
# File 'lib/config_mapper/config_struct.rb', line 217

def factory
  @factory
end

#nameObject (readonly)

Returns the value of attribute name.



214
215
216
# File 'lib/config_mapper/config_struct.rb', line 214

def name
  @name
end

#requiredObject

Returns the value of attribute required.



220
221
222
# File 'lib/config_mapper/config_struct.rb', line 220

def required
  @required
end

#validatorObject

Returns the value of attribute validator.



218
219
220
# File 'lib/config_mapper/config_struct.rb', line 218

def validator
  @validator
end

Instance Method Details

#config_docObject



231
232
233
# File 'lib/config_mapper/config_struct.rb', line 231

def config_doc
  self_doc.merge(type_doc)
end

#initial_valueObject



222
223
224
225
# File 'lib/config_mapper/config_struct.rb', line 222

def initial_value
  return factory.new if factory
  default
end