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.
142 143 144 145 146 147 148 149 150 |
# File 'lib/alexandria/book_providers.rb', line 142 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.
138 139 140 |
# File 'lib/alexandria/book_providers.rb', line 138 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
138 139 140 |
# File 'lib/alexandria/book_providers.rb', line 138 def name @name end |
#possible_values ⇒ Object (readonly)
Returns the value of attribute possible_values.
138 139 140 |
# File 'lib/alexandria/book_providers.rb', line 138 def possible_values @possible_values end |
#value ⇒ Object
Returns the value of attribute value.
140 141 142 |
# File 'lib/alexandria/book_providers.rb', line 140 def value @value end |
Instance Method Details
#default_value=(new_value) ⇒ Object
152 153 154 |
# File 'lib/alexandria/book_providers.rb', line 152 def default_value=(new_value) self.value = new_value end |
#mandatory? ⇒ Boolean
166 167 168 |
# File 'lib/alexandria/book_providers.rb', line 166 def mandatory? @mandatory end |
#new_value=(new_value) ⇒ Object
156 157 158 159 160 |
# File 'lib/alexandria/book_providers.rb', line 156 def new_value=(new_value) name = @provider.variable_name(self) Alexandria::Preferences.instance.set_variable(name, new_value) self.value = new_value end |
#provider_name ⇒ Object
162 163 164 |
# File 'lib/alexandria/book_providers.rb', line 162 def provider_name @provider.name.downcase end |