Class: Tlux::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/tlux/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = "") ⇒ Session

Returns a new instance of Session.



5
6
7
8
9
# File 'lib/tlux/session.rb', line 5

def initialize(name = "")
  @name = name
  @dir = Dir.pwd
  @windows = []
end

Instance Attribute Details

#windowsObject (readonly)

Returns the value of attribute windows.



3
4
5
# File 'lib/tlux/session.rb', line 3

def windows
  @windows
end

Instance Method Details

#dir(val = nil) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/tlux/session.rb', line 25

def dir(val = nil)
  if val.nil?
    @dir
  else
    @dir = val
  end
end

#get_bindingObject



33
34
35
# File 'lib/tlux/session.rb', line 33

def get_binding
  binding
end

#name(val = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/tlux/session.rb', line 17

def name(val = nil)
  if val.nil?
    @name.empty? ? name_from_dir : @name
  else
    @name = val
  end
end

#window(name, opts = {}, &block) ⇒ Object



11
12
13
14
15
# File 'lib/tlux/session.rb', line 11

def window(name, opts = {}, &block)
  window = Tlux::Window.new(name, opts)
  @windows << window
  window.instance_eval(&block) if block_given?
end