Class: TkWrapper::Widgets::Base::TkOptions
- Inherits:
-
Object
- Object
- TkWrapper::Widgets::Base::TkOptions
show all
- Defined in:
- lib/widgets/base/tk_options.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(widget) ⇒ TkOptions
20
21
22
23
|
# File 'lib/widgets/base/tk_options.rb', line 20
def initialize(widget)
@widget = widget
@padding = TkWrapper::Widgets::Base::Padding.new(@widget)
end
|
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.tk_widget[key[0..-2].to_sym] = value
else
@widget.tk_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.tk_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?(*)
false
end
|