Method: Ruber::EditorView#execute_action

Defined in:
lib/ruber/editor/editor_view.rb

#execute_action(name, arg = nil) ⇒ Object

Executes the action with name the view’s action collection. This is made by having the action emit the triggered() or toggled(bool) signal (depending on whether it’s a standard action or a KDE::ToggleAction). In the second case, arg is the argument passed to the signal.

Returns true if an action with name name was found and false otherwise.


165
166
167
168
169
170
171
172
173
# File 'lib/ruber/editor/editor_view.rb', line 165

def execute_action name, arg = nil
  a = action_collection.action(name)
  case a
  when KDE::ToggleAction then a.instance_eval{emit toggled(arg)}
  when nil then return false
  else a.instance_eval{emit triggered}
  end
  true
end