class R3Status::Blocks::ShellBlock

Attributes

click_commands[RW]
command[RW]

Public Class Methods

new(**args, &block) click to toggle source
Calls superclass method R3Status::Blocks::Base::new
# File lib/r3status/blocks/shell.rb, line 5
def initialize(**args, &block)
  super(args, &block)
end

Public Instance Methods

clicked(button, x, y) click to toggle source
Calls superclass method R3Status::Blocks::Base#clicked
# File lib/r3status/blocks/shell.rb, line 19
def clicked(button, x, y)
  super(button, x, y)
  
  case click_commands.class
  when String
    `#{click_commands}`
  when Array
    `#{click_commands[button - 1]}`
  when Hash
    `#{click_commands[button]}`
  end
end
update() click to toggle source
# File lib/r3status/blocks/shell.rb, line 9
def update
  return if command.nil?
  
  cmd = `#{command}`.split.map {|str| str.chomp}
  return if cmd.length == 0
  
  @full_text = cmd[0]
  @text_color = cmd[1] if cmd.length >= 2
end