Class: TmuxConnector::Send

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux-connector/commands/send.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Send

Returns a new instance of Send.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tmux-connector/commands/send.rb', line 16

def initialize(args)
  @name = args['<session-name>']
  @verbose = args['--verbose']

  load_commands args

  process_server_filter args['--server-filter'] rescue raise "error parsing server filter ('#{ args['--server-filter'] }')"

  @group_filter = Regexp.new(args['--group-filter']) rescue nil

  @server_filter ||= Regexp.new(args['--filter']) rescue nil
  @group_filter ||= Regexp.new(args['--filter']) rescue nil

  @window = args['--window']

  @session = Session.load_by_name args['<session-name>']
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



7
8
9
# File 'lib/tmux-connector/commands/send.rb', line 7

def commands
  @commands
end

#filter_predicateObject (readonly)

Returns the value of attribute filter_predicate.



8
9
10
# File 'lib/tmux-connector/commands/send.rb', line 8

def filter_predicate
  @filter_predicate
end

#group_filterObject (readonly)

Returns the value of attribute group_filter.



9
10
11
# File 'lib/tmux-connector/commands/send.rb', line 9

def group_filter
  @group_filter
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/tmux-connector/commands/send.rb', line 10

def name
  @name
end

#server_filterObject (readonly)

Returns the value of attribute server_filter.



11
12
13
# File 'lib/tmux-connector/commands/send.rb', line 11

def server_filter
  @server_filter
end

#sessionObject (readonly)

Returns the value of attribute session.



12
13
14
# File 'lib/tmux-connector/commands/send.rb', line 12

def session
  @session
end

#verboseObject (readonly)

Returns the value of attribute verbose.



13
14
15
# File 'lib/tmux-connector/commands/send.rb', line 13

def verbose
  @verbose
end

#windowObject (readonly)

Returns the value of attribute window.



14
15
16
# File 'lib/tmux-connector/commands/send.rb', line 14

def window
  @window
end

Instance Method Details

#runObject



34
35
36
37
38
39
40
41
# File 'lib/tmux-connector/commands/send.rb', line 34

def run()
  opts = {
    verbose: verbose,
    filter_predicate: filter_predicate
  }

  session.tmux_session.send_commands(commands, server_filter, group_filter, window, opts)
end