Class: BindCommandHandler
- Inherits:
-
Object
- Object
- BindCommandHandler
- Includes:
- CommandHandler
- Defined in:
- lib/command_handlers/bind_command_handler.rb
Overview
Responsible for setting up the return value of the bind keyword (command symbol) as a ModelBinding. It is then used by another command handler like DataBindingCommandHandler for text and selection properties on Text and Spinner or TableItemsDataBindingCommandHandler for items in a Table
Instance Method Summary collapse
- #can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
- #do_handle(parent, command_symbol, *args, &block) ⇒ Object
Instance Method Details
#can_handle?(parent, command_symbol, *args, &block) ⇒ Boolean
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/command_handlers/bind_command_handler.rb', line 14 def can_handle?(parent, command_symbol, *args, &block) ( parent.is_a?(RWidget) and command_symbol.to_s == "bind" and ( ( (args.size == 2) and ( args[1].is_a?(Symbol) or args[1].is_a?(String) ) ) or ( (args.size == 3) and (args[1].is_a?(Symbol) or args[1].is_a?(String)) and (args[2].is_a?(Symbol) or args[2].is_a?(String) or args[2].is_a?(Hash)) ) or ( (args.size == 4) and (args[1].is_a?(Symbol) or args[1].is_a?(String)) and (args[2].is_a?(Symbol) or args[2].is_a?(String)) and (args[3].is_a?(Hash)) ) ) and block == nil ) end |
#do_handle(parent, command_symbol, *args, &block) ⇒ Object
42 43 44 45 46 47 |
# File 'lib/command_handlers/bind_command_handler.rb', line 42 def do_handle(parent, command_symbol, *args, &block) property_type = args[2] if (args.size == 3) && !args[2].is_a?(Hash) = args[2] if args[2].is_a?(Hash) = args[3] if args[3].is_a?(Hash) ModelBinding.new(args[0], args[1].to_s, property_type, ) end |