Class: Begin::ValueTag
Overview
Represents a tag with a single value. Value tags can have a default value assigned in the config. If the user chooses not to enter a value, the default value is substituted instead.
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
Attributes inherited from Tag
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, label, array, default) ⇒ ValueTag
constructor
A new instance of ValueTag.
Constructor Details
#initialize(key, label, array, default) ⇒ ValueTag
Returns a new instance of ValueTag.
61 62 63 64 |
# File 'lib/begin/config.rb', line 61 def initialize(key, label, array, default) super key, label, array @default = default end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
59 60 61 |
# File 'lib/begin/config.rb', line 59 def default @default end |
Class Method Details
.from_config(key, value) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/begin/config.rb', line 66 def self.from_config(key, value) array = value.include?('array') ? value['array'] : false label = value.include?('label') ? value['label'] : key default = value.include?('default') ? value['default'] : '' ValueTag.new key, label, array, default end |