Class: Ace::Tmux::Models::Window
- Inherits:
-
Object
- Object
- Ace::Tmux::Models::Window
- Defined in:
- lib/ace/tmux/models/window.rb
Overview
Represents a tmux window configuration
Instance Attribute Summary collapse
-
#focus ⇒ Object
readonly
Returns the value of attribute focus.
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#layout_tree ⇒ Object
readonly
Returns the value of attribute layout_tree.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#panes ⇒ Object
readonly
Returns the value of attribute panes.
-
#pre_window ⇒ Object
readonly
Returns the value of attribute pre_window.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #focus? ⇒ Boolean
-
#initialize(name: nil, layout: nil, root: nil, panes: [], pre_window: nil, focus: false, options: {}, layout_tree: nil) ⇒ Window
constructor
A new instance of Window.
-
#nested_layout? ⇒ Boolean
True if this window uses a nested layout tree.
- #to_h ⇒ Object
Constructor Details
#initialize(name: nil, layout: nil, root: nil, panes: [], pre_window: nil, focus: false, options: {}, layout_tree: nil) ⇒ Window
Returns a new instance of Window.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ace/tmux/models/window.rb', line 18 def initialize(name: nil, layout: nil, root: nil, panes: [], pre_window: nil, focus: false, options: {}, layout_tree: nil) @name = name @layout = layout @root = root @panes = panes @pre_window = pre_window @focus = focus @options = || {} @layout_tree = layout_tree end |
Instance Attribute Details
#focus ⇒ Object (readonly)
Returns the value of attribute focus.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def focus @focus end |
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def layout @layout end |
#layout_tree ⇒ Object (readonly)
Returns the value of attribute layout_tree.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def layout_tree @layout_tree end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def @options end |
#panes ⇒ Object (readonly)
Returns the value of attribute panes.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def panes @panes end |
#pre_window ⇒ Object (readonly)
Returns the value of attribute pre_window.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def pre_window @pre_window end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
8 9 10 |
# File 'lib/ace/tmux/models/window.rb', line 8 def root @root end |
Instance Method Details
#focus? ⇒ Boolean
34 35 36 |
# File 'lib/ace/tmux/models/window.rb', line 34 def focus? @focus == true end |
#nested_layout? ⇒ Boolean
Returns true if this window uses a nested layout tree.
30 31 32 |
# File 'lib/ace/tmux/models/window.rb', line 30 def nested_layout? !@layout_tree.nil? end |
#to_h ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/ace/tmux/models/window.rb', line 38 def to_h hash = {"name" => @name, "panes" => @panes.map(&:to_h)} hash["layout"] = @layout if @layout hash["root"] = @root if @root hash["pre_window"] = @pre_window if @pre_window hash["focus"] = @focus if @focus hash["options"] = @options unless @options.empty? hash end |