Class: Alexandria::BookProviders::Preferences::Variable
- Inherits:
-
Object
- Object
- Alexandria::BookProviders::Preferences::Variable
- Defined in:
- lib/alexandria/book_providers.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#possible_values ⇒ Object
readonly
Returns the value of attribute possible_values.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #default_value=(new_value) ⇒ Object
-
#initialize(provider, name, description, default_value, possible_values = nil, mandatory = true) ⇒ Variable
constructor
A new instance of Variable.
- #mandatory? ⇒ Boolean
- #new_value=(new_value) ⇒ Object
- #provider_name ⇒ Object
Constructor Details
#initialize(provider, name, description, default_value, possible_values = nil, mandatory = true) ⇒ Variable
Returns a new instance of Variable.
139 140 141 142 143 144 145 146 147 148 |
# File 'lib/alexandria/book_providers.rb', line 139 def initialize(provider, name, description, default_value, possible_values = nil, mandatory = true) @provider = provider @name = name @description = description @value = default_value @possible_values = possible_values @mandatory = mandatory end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
135 136 137 |
# File 'lib/alexandria/book_providers.rb', line 135 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
135 136 137 |
# File 'lib/alexandria/book_providers.rb', line 135 def name @name end |
#possible_values ⇒ Object (readonly)
Returns the value of attribute possible_values.
135 136 137 |
# File 'lib/alexandria/book_providers.rb', line 135 def possible_values @possible_values end |
#value ⇒ Object
Returns the value of attribute value.
137 138 139 |
# File 'lib/alexandria/book_providers.rb', line 137 def value @value end |
Instance Method Details
#default_value=(new_value) ⇒ Object
150 151 152 |
# File 'lib/alexandria/book_providers.rb', line 150 def default_value=(new_value) self.value = new_value end |
#mandatory? ⇒ Boolean
165 166 167 |
# File 'lib/alexandria/book_providers.rb', line 165 def mandatory? @mandatory end |
#new_value=(new_value) ⇒ Object
154 155 156 157 158 159 |
# File 'lib/alexandria/book_providers.rb', line 154 def new_value=(new_value) = @provider.variable_name(self) + '=' Alexandria::Preferences.instance.send(, new_value) self.value = new_value end |
#provider_name ⇒ Object
161 162 163 |
# File 'lib/alexandria/book_providers.rb', line 161 def provider_name @provider.name.downcase end |