Refactor Window#initialize filters and options

This commit is contained in:
Rémi Prévost 2011-10-24 07:43:37 -04:00
parent 7288d0ab57
commit 2a2fc58063

View File

@ -42,17 +42,17 @@ module Teamocil
def initialize(session, index, attrs={}) # {{{ def initialize(session, index, attrs={}) # {{{
@name = attrs["name"] @name = attrs["name"]
@root = attrs["root"] @root = attrs["root"]
@options = attrs["options"] @options = attrs["options"] || {}
@filters = attrs["filters"]
@splits = attrs["splits"] || [] @splits = attrs["splits"] || []
@splits = @splits.each_with_index.map { |split, index| Split.new(self, index, split) } @splits = @splits.each_with_index.map { |split, index| Split.new(self, index, split) }
@index = index
@session = session
@options ||= {} @filters = attrs["filters"] || {}
@filters ||= {}
@filters["before"] ||= [] @filters["before"] ||= []
@filters["after"] ||= [] @filters["after"] ||= []
@index = index
@session = session
end # }}} end # }}}
# Generate commands to send to tmux # Generate commands to send to tmux
@ -94,6 +94,7 @@ module Teamocil
@width = attrs["width"] @width = attrs["width"]
@cmd = attrs["cmd"] @cmd = attrs["cmd"]
@target = attrs["target"] @target = attrs["target"]
@window = window @window = window
@index = index @index = index
end # }}} end # }}}