Class: IronNails::View::AddSubViewCommand
- Defined in:
- lib/ironnails/view/commands/add_sub_view_command.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
the controller for the subview.
-
#target ⇒ Object
the target that will contain the view for this controller.
Attributes inherited from Command
#action, #callback, #condition, #mode, #name, #view
Instance Method Summary collapse
-
#execute ⇒ Object
executes this command (it calls the action).
- #nails_base_command_read_options ⇒ Object
- #read_options(options) ⇒ Object
Methods inherited from Command
#<=>, #==, #asynchronous?, #attached?, #can_execute?, #changed?, #has_callback?, #initialize, #refresh_view, #synchronise_viewmodel_with_controller
Methods included from Core::Observable
#add_observer, #count_observers, #delete_observer, #delete_observers, #notify_observers
Methods included from Logging::ClassLogger
Constructor Details
This class inherits a constructor from IronNails::View::Command
Instance Attribute Details
#controller ⇒ Object
the controller for the subview
8 9 10 |
# File 'lib/ironnails/view/commands/add_sub_view_command.rb', line 8 def controller @controller end |
#target ⇒ Object
the target that will contain the view for this controller
11 12 13 |
# File 'lib/ironnails/view/commands/add_sub_view_command.rb', line 11 def target @target end |
Instance Method Details
#execute ⇒ Object
executes this command (it calls the action)
25 26 27 |
# File 'lib/ironnails/view/commands/add_sub_view_command.rb', line 25 def execute view.add_control target, controller.current_view.instance end |
#nails_base_command_read_options ⇒ Object
13 |
# File 'lib/ironnails/view/commands/add_sub_view_command.rb', line 13 alias_method :nails_base_command_read_options, :read_options |
#read_options(options) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/ironnails/view/commands/add_sub_view_command.rb', line 15 def () raise ArgumentError.new("We need a target to be defined by the :to parameter") if [:to].nil? raise ArgumentError.new("We need a controller instance to be defined in the :controller parameter") if [:controller].nil? || ![:controller].respond_to?(:current_view) @controller = [:controller] @target = [:to] end |