Skip to content

Commit

Permalink
do not accept array arg in #push #insert #unshift
Browse files Browse the repository at this point in the history
closes #10
  • Loading branch information
sunaku committed Feb 20, 2011
1 parent 5fdf926 commit 78bae39
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions lib/rumai/wm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,9 @@ def length
# Inserts the given clients at the bottom of this area.
#
def push *clients
clients.flatten!
return if clients.empty?

insert clients
insert *clients

# move inserted clients to bottom
clients.reverse.each_with_index do |c, i|
Expand All @@ -660,9 +659,6 @@ def push *clients
# currently focused client in this area.
#
def insert *clients
clients.flatten!
return if clients.empty?

clients.each do |c|
import_client c
end
Expand All @@ -672,10 +668,9 @@ def insert *clients
# Inserts the given clients at the top of this area.
#
def unshift *clients
clients.flatten!
return if clients.empty?

insert clients
insert *clients

# move inserted clients to top
clients.each_with_index do |c, i|
Expand All @@ -689,7 +684,7 @@ def unshift *clients
# Concatenates the given area to the bottom of this area.
#
def concat area
push area.clients
push *area.clients
end

##
Expand All @@ -703,14 +698,14 @@ def length= max_clients
len, out = length, fringe

if len > max_clients
out.unshift clients[max_clients..-1]
out.unshift *clients[max_clients..-1]

elsif len < max_clients
until (diff = max_clients - length) == 0
importable = out.clients[0, diff]
break if importable.empty?

push importable
push *importable
end
end
end
Expand Down

0 comments on commit 78bae39

Please sign in to comment.