Module: IronNails::Core::ViewModelCommandOperations

Included in:
ViewModelOperations
Defined in:
lib/ironnails/nails_engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#command_queueObject

gets or sets the command_queue to respond to user actions in the view.



147
148
149
# File 'lib/ironnails/nails_engine.rb', line 147

def command_queue
  @command_queue
end

Instance Method Details

#add_command_to_queue(cmd) ⇒ Object Also known as: add_commands_to_queue

adds a command or a command collection to the queue



163
164
165
166
167
168
169
170
171
172
# File 'lib/ironnails/nails_engine.rb', line 163

def add_command_to_queue(cmd)

  if cmd.respond_to?(:has_command?)
    cmd.each do |c|
      enqueue_command(c)
    end
  elsif cmd.respond_to?(:execute) && cmd.respond_to?(:refresh_view) # define some sort of contract
    enqueue_command(cmd)
  end
end

#init_command_operationsObject



149
150
151
# File 'lib/ironnails/nails_engine.rb', line 149

def init_command_operations
  @command_queue = CommandCollection.new
end