Skip to content

Commit

Permalink
WINDOW method_missing: take block arguments into consideration.
Browse files Browse the repository at this point in the history
  • Loading branch information
syu-id committed Jan 20, 2014
1 parent 1f8f899 commit 2be1db6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ncurses_sugar.rb
Expand Up @@ -57,20 +57,20 @@ module Ncurses
module Destroy_checker; def destroyed?; @destroyed; end; end
class WINDOW
include Destroy_checker
def method_missing(name, *args)
def method_missing(name, *args, &block)
name = name.to_s
if (name[0,2] == "mv")
test_name = name.dup
test_name[2,0] = "w" # insert "w" after"mv"
if (Ncurses.respond_to?(test_name))
return Ncurses.send(test_name, self, *args)
return Ncurses.send(test_name, self, *args, &block)
end
end
test_name = "w" + name
if (Ncurses.respond_to?(test_name))
return Ncurses.send(test_name, self, *args)
return Ncurses.send(test_name, self, *args, &block)
end
Ncurses.send(name, self, *args)
Ncurses.send(name, self, *args, &block)
end
def respond_to?(name)
name = name.to_s
Expand Down

0 comments on commit 2be1db6

Please sign in to comment.