Class: Shoes::Check

Inherits:
Widget show all
Defined in:
lacci/lib/shoes/widgets/check.rb

Constant Summary

Constants included from Log

Log::DEFAULT_COMPONENT, Log::DEFAULT_DEBUG_LOG_CONFIG, Log::DEFAULT_LOG_CONFIG

Instance Attribute Summary

Attributes inherited from Widget

#parent

Attributes inherited from Linkable

#linkable_id

Instance Method Summary collapse

Methods inherited from Widget

#banner, #caption, #destroy, display_properties, display_property, display_property_name?, display_property_names, #display_property_values, #download, dsl_name, #hide, #inscription, #inspect, #method_missing, #respond_to_missing?, #set_parent, #show, #subtitle, #tagline, #title, #toggle, widget_class_by_name

Methods included from Colors

#gray, #rgb, #to_rgb

Methods included from Log

configure_logger, #log_init, logger

Methods inherited from Linkable

#bind_shoes_event, #send_self_event, #send_shoes_event, #unsub_shoes_event

Constructor Details

#initialize(checked = nil, &block) ⇒ Check



7
8
9
10
11
12
13
# File 'lacci/lib/shoes/widgets/check.rb', line 7

def initialize(checked = nil, &block)
  @block = block
  super

  bind_self_event("click") { click }
  create_display_widget
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Shoes::Widget

Instance Method Details

#checked(value) ⇒ Object



24
25
26
# File 'lacci/lib/shoes/widgets/check.rb', line 24

def checked(value)
  self.checked = value
end

#checked?Boolean



20
21
22
# File 'lacci/lib/shoes/widgets/check.rb', line 20

def checked?
  @checked ? true : false
end

#click(&block) ⇒ Object



15
16
17
18
# File 'lacci/lib/shoes/widgets/check.rb', line 15

def click(&block)
  @block = block
  self.checked = !checked?
end