Class: TreeItemsDataBindingCommandHandler

Inherits:
Object
  • Object
show all
Includes:
CommandHandler
Defined in:
lib/command_handlers/tree_items_data_binding_command_handler.rb

Instance Method Summary collapse

Instance Method Details

#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
19
# File 'lib/command_handlers/tree_items_data_binding_command_handler.rb', line 10

def can_handle?(parent, command_symbol, *args, &block)
  (parent.is_a?(RWidget)) and
  (parent.widget.is_a?(Tree)) and
  (command_symbol.to_s == "items") and
  (args.size == 2) and
  (args[0].is_a?(ModelBinding)) and
  (!args[0].evaluate_property.is_a?(Array)) and
  (args[1].is_a?(Array) && !args[1].empty? && args[1].first.is_a?(Hash)) and
  (block == nil)
end

#do_handle(parent, command_symbol, *args, &block) ⇒ Object



21
22
23
24
25
# File 'lib/command_handlers/tree_items_data_binding_command_handler.rb', line 21

def do_handle(parent, command_symbol, *args, &block)
  model_binding = args[0]
  tree_properties = args[1]
  TreeItemsBinding.new(parent, model_binding, tree_properties)
end