Class: TkWrapper::Widgets::Base::TkOptions
- Inherits:
-
Object
- Object
- TkWrapper::Widgets::Base::TkOptions
- Defined in:
- lib/widgets/base/tk_options.rb
Instance Attribute Summary collapse
-
#padding ⇒ Object
Returns the value of attribute padding.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(widget) ⇒ TkOptions
constructor
A new instance of TkOptions.
- #method_missing(key, value = nil) ⇒ Object
- #respond_to_missing? ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, value = nil) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/widgets/base/tk_options.rb', line 29 def method_missing(key, value = nil) if key[-1] == '=' @widget.[key[0..-2].to_sym] = value else @widget.[key] end end |
Instance Attribute Details
#padding ⇒ Object
Returns the value of attribute padding.
6 7 8 |
# File 'lib/widgets/base/tk_options.rb', line 6 def padding @padding end |
Class Method Details
.default_to_zero(*properties) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/widgets/base/tk_options.rb', line 8 def self.default_to_zero(*properties) properties.each do |property| define_method(property) do value = @widget.[property] value.is_a?(Numeric) ? value : 0 end end end |
Instance Method Details
#respond_to_missing? ⇒ Boolean
37 38 39 40 |
# File 'lib/widgets/base/tk_options.rb', line 37 def respond_to_missing?(*) # no known way to check if tk_widget[key] exists false end |