Class: OperaWatir::Preferences::Section::Key
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/operawatir/preferences.rb
Instance Attribute Summary collapse
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#key ⇒ Object
Returns the value of attribute key.
-
#method ⇒ Object
Returns the value of attribute method.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#default ⇒ String
Returns key’s default value.
-
#default! ⇒ String
Returns and sets the default value of the key.
-
#enabled? ⇒ Boolean
Whether the current key entry is enabled inside Opera or not.
-
#initialize(parent, raw_key) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(parent, raw_key) ⇒ Key
Returns a new instance of Key.
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/operawatir/preferences.rb', line 311 def initialize(parent, raw_key) self.parent, self.driver = parent, parent.driver self.method, self.key = raw_key.first.methodize, raw_key.first raw_data = raw_key[1].to_s raw_data =~ /^type: ([A-Z]+)$/ self.type = $1.to_s.capitalize raw_data =~ /^value: \"(.*)\"$/ @value = $1.to_s # Ruby doesn't support attr_accessor's with question mark in their # name. raw_data =~ /^enabled: (true|false)$/ @enabled = $1.truthy? end |
Instance Attribute Details
#driver ⇒ Object
Returns the value of attribute driver.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def driver @driver end |
#key ⇒ Object
Returns the value of attribute key.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def key @key end |
#method ⇒ Object
Returns the value of attribute method.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def method @method end |
#parent ⇒ Object
Returns the value of attribute parent.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def parent @parent end |
#type ⇒ Object
Returns the value of attribute type.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
309 310 311 |
# File 'lib/operawatir/preferences.rb', line 309 def value @value end |
Instance Method Details
#default ⇒ String
Returns key’s default value.
356 357 358 |
# File 'lib/operawatir/preferences.rb', line 356 def default @default ||= driver.getDefaultPref parent.key, key end |
#default! ⇒ String
Returns and sets the default value of the key.
366 367 368 |
# File 'lib/operawatir/preferences.rb', line 366 def default! self.value=(default) end |
#enabled? ⇒ Boolean
Whether the current key entry is enabled inside Opera or not.
334 335 336 |
# File 'lib/operawatir/preferences.rb', line 334 def enabled? !!@enabled end |