Class: Zenity::List

Inherits:
Base
  • Object
show all
Defined in:
lib/zenity/list.rb

Overview

Public: List dialog box wrapper.

Instance Attribute Summary collapse

Attributes inherited from Base

#exit_status

Instance Method Summary collapse

Methods inherited from Base

#cancel?, #error?, #expired?, #ok?, #proceed

Constructor Details

#initialize(columns = ["Column Title"], data = ["Data"], options = []) ⇒ List

Returns a new instance of List.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zenity/list.rb', line 9

def initialize columns = ["Column Title"], data = ["Data"], options = []
  @command = "zenity --list \\\n"
  unless options.empty?
    options.each do |opt|
      if ['checklist', 'radiolist', 'editable'].include? opt
        @command += "--#{opt} \\\n" 
      else
        raise "Unknown option #{opt} for zenity list"
      end
    end
  end
  columns.map! { |col| "--column=\"#{col}\"" }
  @command += columns.join(" ") + " \\\n"
  @command += data.join(" \\\n")
end

Instance Attribute Details

Sets the attribute print_column

Parameters:

  • value

    the value to set the attribute print_column to.



7
8
9
# File 'lib/zenity/list.rb', line 7

def print_column=(value)
  @print_column = value
end

#separator=(value) ⇒ Object (writeonly)

Sets the attribute separator

Parameters:

  • value

    the value to set the attribute separator to.



7
8
9
# File 'lib/zenity/list.rb', line 7

def separator=(value)
  @separator = value
end

Instance Method Details

#get_commandObject



25
26
27
# File 'lib/zenity/list.rb', line 25

def get_command
  @command + option_separator + option_print_column + general_options
end