Class: NewGameFromClipboardAction

Inherits:
AbstractAction
  • Object
show all
Defined in:
lib/life_game_viewer/view/actions.rb

Instance Method Summary collapse

Constructor Details

#initialize(table_model) ⇒ NewGameFromClipboardAction

Returns a new instance of NewGameFromClipboardAction.



183
184
185
186
187
# File 'lib/life_game_viewer/view/actions.rb', line 183

def initialize(table_model)
  super("Paste (V)")
  put_value(SHORT_DESCRIPTION, "Press #{ClipboardHelper.key_prefix}-V to create a new game from the clipboard contents.")
  @table_model = table_model
end

Instance Method Details

#actionPerformed(event) ⇒ Object



189
190
191
192
# File 'lib/life_game_viewer/view/actions.rb', line 189

def actionPerformed(event)
  new_model = @table_model.life_model.class.send(:create_from_string, ClipboardHelper.clipboard_text)
  @table_model.reset_model(new_model)
end