Skip to content

Commit

Permalink
Remove more duplication. [#4]
Browse files Browse the repository at this point in the history
  • Loading branch information
marnen committed Nov 30, 2009
1 parent bf1edf8 commit 96504a9
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/ruby/file_menu.rb
@@ -1,12 +1,25 @@
# Mixin to implement standard File menu actions.
module FileMenu
def file_new_menu_item_action_performed
instance = DocumentController.create_instance
instance.open unless instance.nil?
new_document
end

def file_open_menu_item_action_performed
instance = DocumentController.create_instance(nil, false)
open_document
end

private

def new_document
get_document
end

def open_document
get_document(nil, false)
end

def get_document(*args)
instance = DocumentController.create_instance(*args)
instance.open unless instance.nil?
end
end

0 comments on commit 96504a9

Please sign in to comment.