Class: Ext::Settings::Setting
Overview
This is the class that represent one setting. You should not use that directly but access it trough the YourApp.settings method.
default_value is the value that you specified when defining the setting.
Instance Attribute Summary collapse
-
#default_value ⇒ Object
readonly
klass is not used here.
-
#key ⇒ Object
readonly
klass is not used here.
-
#klass ⇒ Object
readonly
klass is not used here.
-
#value ⇒ Object
klass is not used here.
Instance Method Summary collapse
-
#initialize(klass, key, default_value, &on_change) ⇒ Setting
constructor
A new instance of Setting.
- #on_change(&block) ⇒ Object
Constructor Details
#initialize(klass, key, default_value, &on_change) ⇒ Setting
Returns a new instance of Setting.
141 142 143 144 145 |
# File 'lib/ext/settings.rb', line 141 def initialize(klass, key, default_value, &on_change) @klass, @key = klass, key @on_change = on_change @default_value = self.value = default_value end |
Instance Attribute Details
#default_value ⇒ Object (readonly)
klass is not used here. It’s for YAML.
140 141 142 |
# File 'lib/ext/settings.rb', line 140 def default_value @default_value end |
#key ⇒ Object (readonly)
klass is not used here. It’s for YAML.
140 141 142 |
# File 'lib/ext/settings.rb', line 140 def key @key end |
#klass ⇒ Object (readonly)
klass is not used here. It’s for YAML.
140 141 142 |
# File 'lib/ext/settings.rb', line 140 def klass @klass end |
#value ⇒ Object
klass is not used here. It’s for YAML.
140 141 142 |
# File 'lib/ext/settings.rb', line 140 def value @value end |
Instance Method Details
#on_change(&block) ⇒ Object
156 157 158 159 |
# File 'lib/ext/settings.rb', line 156 def on_change(&block) raise ArgumentError, "please give a block" unless block_given? @on_change = block end |