Class: ConfigManager::Setting
- Inherits:
-
Object
- Object
- ConfigManager::Setting
- Includes:
- ConfigManager::Settings::Persistence, ConfigManager::Settings::Querying, ConfigManager::Settings::Values, ConfigManager::Settings::Yaml
- Defined in:
- lib/config_manager/setting.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #formatted_tags ⇒ Object
-
#initialize(id, value, tags) ⇒ Setting
constructor
A new instance of Setting.
- #message ⇒ Object
- #to_hash ⇒ Object
- #valid? ⇒ Boolean
Methods included from ConfigManager::Settings::Yaml
Methods included from ConfigManager::Settings::Values
Methods included from ConfigManager::Settings::Querying
Methods included from ConfigManager::Settings::Persistence
Constructor Details
#initialize(id, value, tags) ⇒ Setting
Returns a new instance of Setting.
10 11 12 13 14 |
# File 'lib/config_manager/setting.rb', line 10 def initialize(id, value, ) @id = id @value = value @tags = end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/config_manager/setting.rb', line 8 def id @id end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
8 9 10 |
# File 'lib/config_manager/setting.rb', line 8 def @tags end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/config_manager/setting.rb', line 8 def value @value end |
Instance Method Details
#formatted_tags ⇒ Object
20 21 22 |
# File 'lib/config_manager/setting.rb', line 20 def @tags && @tags.join(', ') end |
#message ⇒ Object
24 25 26 27 |
# File 'lib/config_manager/setting.rb', line 24 def return "missing name(id)" unless @id.present? return "missing value" unless !!@value end |
#to_hash ⇒ Object
29 30 31 |
# File 'lib/config_manager/setting.rb', line 29 def to_hash {'id' => id, 'value' => value, 'tags' => } end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/config_manager/setting.rb', line 16 def valid? @id.present? && !!@value end |