glimmer 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +94 -32
  3. data/lib/glimmer.rb +4 -6
  4. data/lib/glimmer/command_handler.rb +10 -0
  5. data/lib/glimmer/command_handler_chain_factory.rb +32 -0
  6. data/lib/glimmer/command_handler_chain_link.rb +21 -0
  7. data/lib/{command_handlers.rb → glimmer/command_handlers.rb} +21 -17
  8. data/lib/glimmer/command_handlers/bind_command_handler.rb +51 -0
  9. data/lib/glimmer/command_handlers/color_command_handler.rb +26 -0
  10. data/lib/glimmer/command_handlers/combo_selection_data_binding_command_handler.rb +40 -0
  11. data/lib/glimmer/command_handlers/data_binding_command_handler.rb +69 -0
  12. data/lib/glimmer/command_handlers/display_command_handler.rb +16 -0
  13. data/lib/glimmer/command_handlers/list_selection_data_binding_command_handler.rb +45 -0
  14. data/lib/glimmer/command_handlers/models/g_color.rb +34 -0
  15. data/lib/glimmer/command_handlers/models/g_display.rb +26 -0
  16. data/lib/glimmer/command_handlers/models/g_font.rb +62 -0
  17. data/lib/glimmer/command_handlers/models/g_runnable.rb +13 -0
  18. data/lib/glimmer/command_handlers/models/g_shell.rb +27 -0
  19. data/lib/glimmer/command_handlers/models/g_swt.rb +22 -0
  20. data/lib/glimmer/command_handlers/models/g_tab_item_composite.rb +33 -0
  21. data/lib/glimmer/command_handlers/models/g_widget.rb +199 -0
  22. data/lib/glimmer/command_handlers/models/g_widget_listener.rb +11 -0
  23. data/lib/glimmer/command_handlers/models/list_selection_binding.rb +47 -0
  24. data/lib/glimmer/command_handlers/models/model_binding.rb +206 -0
  25. data/lib/glimmer/command_handlers/models/observable.rb +11 -0
  26. data/lib/glimmer/command_handlers/models/observable_array.rb +104 -0
  27. data/lib/glimmer/command_handlers/models/observable_model.rb +105 -0
  28. data/lib/glimmer/command_handlers/models/observer.rb +115 -0
  29. data/lib/glimmer/command_handlers/models/table_items_binding.rb +45 -0
  30. data/lib/glimmer/command_handlers/models/tree_items_binding.rb +49 -0
  31. data/lib/glimmer/command_handlers/models/widget_binding.rb +29 -0
  32. data/lib/glimmer/command_handlers/shell_command_handler.rb +17 -0
  33. data/lib/glimmer/command_handlers/tab_item_command_handler.rb +21 -0
  34. data/lib/glimmer/command_handlers/table_column_properties_data_binding_command_handler.rb +25 -0
  35. data/lib/glimmer/command_handlers/table_items_data_binding_command_handler.rb +30 -0
  36. data/lib/glimmer/command_handlers/tree_items_data_binding_command_handler.rb +29 -0
  37. data/lib/glimmer/command_handlers/tree_properties_data_binding_command_handler.rb +25 -0
  38. data/lib/glimmer/command_handlers/widget_command_handler.rb +22 -0
  39. data/lib/glimmer/command_handlers/widget_listener_command_handler.rb +39 -0
  40. data/lib/glimmer/command_handlers/widget_method_command_handler.rb +21 -0
  41. data/lib/glimmer/parent.rb +7 -0
  42. data/lib/{shine.rb → glimmer/shine.rb} +1 -1
  43. data/lib/glimmer/swt_packages.rb +13 -0
  44. data/lib/{xml_command_handlers.rb → glimmer/xml_command_handlers.rb} +10 -8
  45. data/lib/glimmer/xml_command_handlers/html_command_handler.rb +47 -0
  46. data/lib/glimmer/xml_command_handlers/models/depth_first_search_iterator.rb +19 -0
  47. data/lib/glimmer/xml_command_handlers/models/name_space_visitor.rb +20 -0
  48. data/lib/glimmer/xml_command_handlers/models/node.rb +82 -0
  49. data/lib/glimmer/xml_command_handlers/models/node_visitor.rb +11 -0
  50. data/lib/glimmer/xml_command_handlers/models/xml_visitor.rb +61 -0
  51. data/lib/glimmer/xml_command_handlers/xml_command_handler.rb +20 -0
  52. data/lib/glimmer/xml_command_handlers/xml_name_space_command_handler.rb +33 -0
  53. data/lib/glimmer/xml_command_handlers/xml_tag_command_handler.rb +25 -0
  54. data/lib/glimmer/xml_command_handlers/xml_text_command_handler.rb +21 -0
  55. metadata +53 -54
  56. data/lib/command_handler.rb +0 -8
  57. data/lib/command_handler_chain_factory.rb +0 -30
  58. data/lib/command_handler_chain_link.rb +0 -19
  59. data/lib/command_handlers/bind_command_handler.rb +0 -49
  60. data/lib/command_handlers/color_command_handler.rb +0 -24
  61. data/lib/command_handlers/combo_selection_data_binding_command_handler.rb +0 -38
  62. data/lib/command_handlers/data_binding_command_handler.rb +0 -67
  63. data/lib/command_handlers/list_selection_data_binding_command_handler.rb +0 -43
  64. data/lib/command_handlers/models/block_observer.rb +0 -14
  65. data/lib/command_handlers/models/list_selection_binding.rb +0 -45
  66. data/lib/command_handlers/models/model_binding.rb +0 -205
  67. data/lib/command_handlers/models/observable.rb +0 -9
  68. data/lib/command_handlers/models/observable_array.rb +0 -102
  69. data/lib/command_handlers/models/observable_model.rb +0 -103
  70. data/lib/command_handlers/models/observer.rb +0 -88
  71. data/lib/command_handlers/models/r_color.rb +0 -32
  72. data/lib/command_handlers/models/r_font.rb +0 -60
  73. data/lib/command_handlers/models/r_runnable.rb +0 -11
  74. data/lib/command_handlers/models/r_shell.rb +0 -24
  75. data/lib/command_handlers/models/r_swt.rb +0 -18
  76. data/lib/command_handlers/models/r_tab_item_composite.rb +0 -31
  77. data/lib/command_handlers/models/r_widget.rb +0 -183
  78. data/lib/command_handlers/models/r_widget_listener.rb +0 -9
  79. data/lib/command_handlers/models/table_items_binding.rb +0 -43
  80. data/lib/command_handlers/models/tree_items_binding.rb +0 -47
  81. data/lib/command_handlers/models/widget_binding.rb +0 -27
  82. data/lib/command_handlers/shell_command_handler.rb +0 -15
  83. data/lib/command_handlers/tab_item_command_handler.rb +0 -19
  84. data/lib/command_handlers/table_column_properties_data_binding_command_handler.rb +0 -23
  85. data/lib/command_handlers/table_items_data_binding_command_handler.rb +0 -28
  86. data/lib/command_handlers/tree_items_data_binding_command_handler.rb +0 -27
  87. data/lib/command_handlers/tree_properties_data_binding_command_handler.rb +0 -23
  88. data/lib/command_handlers/widget_command_handler.rb +0 -20
  89. data/lib/command_handlers/widget_listener_command_handler.rb +0 -37
  90. data/lib/command_handlers/widget_method_command_handler.rb +0 -19
  91. data/lib/parent.rb +0 -5
  92. data/lib/string.rb +0 -8
  93. data/lib/swt_packages.rb +0 -11
  94. data/lib/symbol.rb +0 -10
  95. data/lib/xml_command_handlers/html_command_handler.rb +0 -45
  96. data/lib/xml_command_handlers/models/depth_first_search_iterator.rb +0 -17
  97. data/lib/xml_command_handlers/models/name_space_visitor.rb +0 -18
  98. data/lib/xml_command_handlers/models/node.rb +0 -80
  99. data/lib/xml_command_handlers/models/node_visitor.rb +0 -9
  100. data/lib/xml_command_handlers/models/xml_visitor.rb +0 -59
  101. data/lib/xml_command_handlers/xml_command_handler.rb +0 -18
  102. data/lib/xml_command_handlers/xml_name_space_command_handler.rb +0 -31
  103. data/lib/xml_command_handlers/xml_tag_command_handler.rb +0 -23
  104. data/lib/xml_command_handlers/xml_text_command_handler.rb +0 -19
@@ -0,0 +1,115 @@
1
+ require 'set'
2
+
3
+ module Glimmer
4
+ # Mixin representing Observer trait from Observer Design Pattern
5
+ # Allows classes to include without interfering with their
6
+ # inheritance hierarchy.
7
+ #
8
+ # Includes a default implementation that can receive an observer block
9
+ # Example: Observer.proc {|new_value| puts new_value}
10
+ # Subclasses may override
11
+ module Observer
12
+ # Observer Proc default implementation that takes an observer block to process updates
13
+ # via call method
14
+ class Proc
15
+ include Observer
16
+
17
+ def initialize(&observer_block)
18
+ @observer_block = observer_block
19
+ end
20
+
21
+ # Called by observables once updates occur sending in the new_value if any
22
+ def call(new_value=nil)
23
+ @observer_block.call(new_value)
24
+ end
25
+ end
26
+
27
+ class << self
28
+ def proc(&observer_block)
29
+ Proc.new(&observer_block)
30
+ end
31
+ end
32
+
33
+ def registrations
34
+ @registrations ||= Set.new
35
+ end
36
+
37
+ def registrations_for(observable, property = nil)
38
+ registrations.select {|o, p| o == observable && p == property}
39
+ end
40
+
41
+ # mapping of registrations to dependents
42
+ # {[observable, property] => [[dependent, dependent_observable, dependent_property], ...]}
43
+ def dependents
44
+ @dependents ||= Hash.new
45
+ end
46
+
47
+ def dependents_for(registration)
48
+ dependents[registration] ||= Set.new
49
+ end
50
+
51
+ # registers observer in an observable on a property (optional)
52
+ # observer maintains registration list to unregister later
53
+ def register(observable, property = nil)
54
+ unless observable.is_a?(Observable)
55
+ # TODO refactor code to be more smart/polymorphic/automated and honor open/closed principle
56
+ if observable.is_a?(Array)
57
+ observable.extend(ObservableArray)
58
+ else
59
+ observable.extend(ObservableModel)
60
+ end
61
+ end
62
+ observable.add_observer(*[self, property].compact)
63
+ [observable, property].tap do |registration|
64
+ self.registrations << registration
65
+ end
66
+ end
67
+ alias observe register
68
+
69
+ def unregister(observable, property = nil)
70
+ observable.remove_observer(*[self, property].compact)
71
+ registration = [observable, property]
72
+ dependents_for(registration).each do |dependent|
73
+ dependent_observer, dependent_observable, dependent_property = dependent
74
+ dependent_observer.unregister(dependent_observable, dependent_property)
75
+ remove_dependent(registration => dependent)
76
+ end
77
+ registrations.delete(registration)
78
+ end
79
+ alias unobserve unregister
80
+
81
+ def unregister_dependents_with_observable(registration, dependent_observable)
82
+ thedependents = dependents_for(registration).select do |d_observer, d_observable, d_property|
83
+ d_observable == dependent_observable
84
+ end
85
+ thedependents.each do |d_observer, d_observable, d_property|
86
+ d_observer.unregister(d_observable, d_property)
87
+ end
88
+ end
89
+
90
+ # cleans up all registrations in observables
91
+ def unregister_all_observables
92
+ registrations.each do |observable, property|
93
+ unregister(observable, property)
94
+ end
95
+ end
96
+ alias unobserve_all_observables unregister_all_observables
97
+
98
+ # add dependent observer to unregister when unregistering observer
99
+ def add_dependent(parent_to_dependent_hash)
100
+ observable, property = registration = parent_to_dependent_hash.keys.first
101
+ dependent_observer, dependent_observable, dependent_property = dependent = parent_to_dependent_hash.values.first
102
+ dependents_for(registration) << dependent
103
+ end
104
+
105
+ def remove_dependent(parent_to_dependent_hash)
106
+ observable, property = registration = parent_to_dependent_hash.keys.first
107
+ dependent_observer, dependent_observable, dependent_property = dependent = parent_to_dependent_hash.values.first
108
+ dependents_for(registration).delete(dependent)
109
+ end
110
+
111
+ def call(new_value)
112
+ raise 'Not implemented!'
113
+ end
114
+ end
115
+ end
@@ -0,0 +1,45 @@
1
+ require_relative 'observable_array'
2
+ require_relative 'observable_model'
3
+ require_relative 'observable'
4
+ require_relative 'observer'
5
+
6
+ module Glimmer
7
+ class TableItemsBinding
8
+ include Glimmer
9
+ include Observable
10
+ include Observer
11
+ include_package 'org.eclipse.swt'
12
+ include_package 'org.eclipse.swt.widgets'
13
+
14
+ def initialize(parent, model_binding, column_properties)
15
+ @table = parent
16
+ @model_binding = model_binding
17
+ @column_properties = column_properties
18
+ call(@model_binding.evaluate_property)
19
+ model = model_binding.base_model
20
+ observe(model, model_binding.property_name_expression)
21
+ add_contents(@table) {
22
+ on_widget_disposed { |dispose_event|
23
+ unregister_all_observables
24
+ }
25
+ }
26
+ end
27
+ def call(model_collection=nil)
28
+ if model_collection and model_collection.is_a?(Array)
29
+ observe(model_collection, @column_properties)
30
+ @model_collection = model_collection
31
+ end
32
+ populate_table(@model_collection, @table, @column_properties)
33
+ end
34
+ def populate_table(model_collection, parent, column_properties)
35
+ parent.widget.removeAll
36
+ model_collection.each do |model|
37
+ table_item = TableItem.new(parent.widget, GSWT[:none])
38
+ for index in 0..(column_properties.size-1)
39
+ table_item.setText(index, model.send(column_properties[index]).to_s)
40
+ end
41
+ end
42
+ end
43
+
44
+ end
45
+ end
@@ -0,0 +1,49 @@
1
+ require_relative 'observable_array'
2
+ require_relative 'observable_model'
3
+ require_relative 'observable'
4
+ require_relative 'observer'
5
+
6
+ module Glimmer
7
+ class TreeItemsBinding
8
+ include Glimmer
9
+ include Observable
10
+ include Observer
11
+ include_package 'org.eclipse.swt'
12
+ include_package 'org.eclipse.swt.widgets'
13
+
14
+ def initialize(parent, model_binding, tree_properties)
15
+ @tree = parent
16
+ @model_binding = model_binding
17
+ @tree_properties = [tree_properties].flatten.first.to_h
18
+ call(@model_binding.evaluate_property)
19
+ model = model_binding.base_model
20
+ observe(model, model_binding.property_name_expression)
21
+ add_contents(@tree) {
22
+ on_widget_disposed { |dispose_event|
23
+ unregister_all_observables
24
+ }
25
+ }
26
+ end
27
+ def call(model_tree_root_node=nil)
28
+ if model_tree_root_node and model_tree_root_node.respond_to?(@tree_properties[:children])
29
+ observe(model_tree_root_node, @tree_properties[:text])
30
+ observe(model_tree_root_node, @tree_properties[:children])
31
+ @model_tree_root_node = model_tree_root_node
32
+ end
33
+ populate_tree(@model_tree_root_node, @tree, @tree_properties)
34
+ end
35
+ def populate_tree(model_tree_root_node, parent, tree_properties)
36
+ parent.widget.removeAll
37
+ populate_tree_node(model_tree_root_node, parent.widget, tree_properties)
38
+ end
39
+ def populate_tree_node(model_tree_node, parent, tree_properties)
40
+ table_item = TreeItem.new(parent, GSWT[:none])
41
+ table_item.setText((model_tree_node && model_tree_node.send(tree_properties[:text])).to_s)
42
+ [model_tree_node && model_tree_node.send(tree_properties[:children])].flatten.to_a.compact.each do |child|
43
+ observe(child, @tree_properties[:text])
44
+ populate_tree_node(child, table_item, tree_properties)
45
+ end
46
+ end
47
+
48
+ end
49
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'observable'
2
+ require_relative 'observer'
3
+
4
+ module Glimmer
5
+ class WidgetBinding
6
+ include Glimmer
7
+ include Observable
8
+ include Observer
9
+
10
+ attr_reader :widget, :property
11
+ def initialize(model, property, translator = nil)
12
+ @widget = model
13
+ @property = property
14
+ @translator = translator || proc {|value| value}
15
+ add_contents(@widget) {
16
+ on_widget_disposed { |dispose_event|
17
+ unregister_all_observables
18
+ }
19
+ }
20
+ end
21
+ def call(value)
22
+ converted_value = translated_value = @translator.call(value)
23
+ @widget.set_attribute(@property, converted_value) unless evaluate_property == converted_value
24
+ end
25
+ def evaluate_property
26
+ @widget.widget.send(@property)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_shell"
3
+
4
+ module Glimmer
5
+ class ShellCommandHandler
6
+ include CommandHandler
7
+
8
+ def can_handle?(parent, command_symbol, *args, &block)
9
+ command_symbol.to_s == "shell"
10
+ end
11
+
12
+ def do_handle(parent, command_symbol, *args, &block)
13
+ GShell.send(:new, *args)
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_shell"
3
+ require File.dirname(__FILE__) + "/models/g_tab_item_composite"
4
+
5
+ module Glimmer
6
+ class TabItemCommandHandler
7
+ include CommandHandler
8
+ include Glimmer
9
+
10
+ def can_handle?(parent, command_symbol, *args, &block)
11
+ parent.is_a?(GWidget) and
12
+ command_symbol.to_s == "tab_item"
13
+ end
14
+
15
+ def do_handle(parent, command_symbol, *args, &block)
16
+ tab_item = GWidget.new(command_symbol.to_s, parent.widget, args)
17
+ GTabItemComposite.new(tab_item, parent.widget, args)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+
4
+ module Glimmer
5
+ # Responsible for providing a readable keyword (command symbol) to capture
6
+ # and return column properties for use in TreeItemsDataBindingCommandHandler
7
+ class TableColumnPropertiesDataBindingCommandHandler
8
+ include CommandHandler
9
+
10
+ include_package 'org.eclipse.swt'
11
+ include_package 'org.eclipse.swt.widgets'
12
+
13
+ def can_handle?(parent, command_symbol, *args, &block)
14
+ parent.is_a?(GWidget) and
15
+ parent.widget.is_a?(Table) and
16
+ command_symbol.to_s == "column_properties" and
17
+ block == nil
18
+ end
19
+
20
+ def do_handle(parent, command_symbol, *args, &block)
21
+ args
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+ require File.dirname(__FILE__) + "/models/table_items_binding"
4
+
5
+ module Glimmer
6
+ #Depends on BindCommandHandler and TableColumnPropertiesDataBindingCommandHandler
7
+ class TableItemsDataBindingCommandHandler
8
+ include CommandHandler
9
+
10
+ include_package 'org.eclipse.swt.widgets'
11
+
12
+ def can_handle?(parent, command_symbol, *args, &block)
13
+ parent.is_a?(GWidget) and
14
+ parent.widget.is_a?(Table) and
15
+ command_symbol.to_s == "items" and
16
+ args.size == 2 and
17
+ args[0].is_a?(ModelBinding) and
18
+ args[0].evaluate_property.is_a?(Array) and
19
+ args[1].is_a?(Array) and
20
+ block == nil
21
+ end
22
+
23
+ def do_handle(parent, command_symbol, *args, &block)
24
+ model_binding = args[0]
25
+ column_properties = args[1]
26
+ TableItemsBinding.new(parent, model_binding, column_properties)
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+ require File.dirname(__FILE__) + "/models/tree_items_binding"
4
+
5
+ module Glimmer
6
+ class TreeItemsDataBindingCommandHandler
7
+ include CommandHandler
8
+
9
+ include_package 'org.eclipse.swt.widgets'
10
+
11
+ def can_handle?(parent, command_symbol, *args, &block)
12
+ (parent.is_a?(GWidget)) and
13
+ (parent.widget.is_a?(Tree)) and
14
+ (command_symbol.to_s == "items") and
15
+ (args.size == 2) and
16
+ (args[0].is_a?(ModelBinding)) and
17
+ (!args[0].evaluate_property.is_a?(Array)) and
18
+ (args[1].is_a?(Array) && !args[1].empty? && args[1].first.is_a?(Hash)) and
19
+ (block == nil)
20
+ end
21
+
22
+ def do_handle(parent, command_symbol, *args, &block)
23
+ model_binding = args[0]
24
+ tree_properties = args[1]
25
+ TreeItemsBinding.new(parent, model_binding, tree_properties)
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+
4
+ module Glimmer
5
+ # Responsible for providing a readable keyword (command symbol) to capture
6
+ # and return tree properties for use in TreeItemsDataBindingCommandHandler
7
+ class TreePropertiesDataBindingCommandHandler
8
+ include CommandHandler
9
+
10
+ include_package 'org.eclipse.swt'
11
+ include_package 'org.eclipse.swt.widgets'
12
+
13
+ def can_handle?(parent, command_symbol, *args, &block)
14
+ parent.is_a?(GWidget) and
15
+ parent.widget.is_a?(Tree) and
16
+ command_symbol.to_s == "tree_properties" and
17
+ block == nil
18
+ end
19
+
20
+ def do_handle(parent, command_symbol, *args, &block)
21
+ args
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+
4
+ module Glimmer
5
+ class WidgetCommandHandler
6
+ include CommandHandler
7
+
8
+ include_package 'org.eclipse.swt.widgets'
9
+
10
+ def can_handle?(parent, command_symbol, *args, &block)
11
+ parent.is_a?(GWidget) and
12
+ command_symbol.to_s != "shell" and
13
+ GWidget.widget_exists?(command_symbol.to_s)
14
+ end
15
+
16
+ def do_handle(parent, command_symbol, *args, &block)
17
+ Glimmer.logger.debug "widget styles are: " + args.inspect
18
+ GWidget.new(command_symbol.to_s, parent.widget, args)
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,39 @@
1
+ require File.dirname(__FILE__) + "/../command_handler"
2
+ require File.dirname(__FILE__) + "/models/g_widget"
3
+
4
+ module Glimmer
5
+ class WidgetListenerCommandHandler
6
+ include CommandHandler
7
+
8
+ include_package 'org.eclipse.swt.widgets'
9
+
10
+ def can_handle?(parent, command_symbol, *args, &block)
11
+ Glimmer.logger.debug "parent is a widget: " + (parent.is_a?(GWidget)).to_s
12
+ return unless parent.is_a?(GWidget)
13
+ Glimmer.logger.debug "on listener?: " + (command_symbol.to_s[0,3] == "on_").to_s
14
+ return unless command_symbol.to_s[0,3] == "on_"
15
+ Glimmer.logger.debug "command symbol is longer than 3: " + (command_symbol.to_s.length > 3).to_s
16
+ return unless command_symbol.to_s.length > 3
17
+ Glimmer.logger.debug "args are 0?: " + (args.size == 0).to_s
18
+ return unless args.size == 0
19
+ Glimmer.logger.debug "can add listener? " + (parent.can_add_listener?(command_symbol.to_s[3, command_symbol.to_s.length])).to_s
20
+ parent.can_add_listener?(command_symbol.to_s[3, command_symbol.to_s.length])
21
+ end
22
+
23
+ def do_handle(parent, command_symbol, *args, &block)
24
+ parent.add_listener(command_symbol.to_s[3, command_symbol.to_s.length], &block)
25
+ ListenerParent.new #TODO refactor and move to models
26
+ end
27
+
28
+ #TODO refactor and move to separate file
29
+ class ListenerParent
30
+ include Parent
31
+
32
+ def process_block(block)
33
+ #NOOP
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+ end