Class: RelayHelper::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/weechat-relay-helper/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Options

Returns a new instance of Options.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/weechat-relay-helper/options.rb', line 5

def initialize args
  OptionParser.new do |opts|
    opts.banner = "Usage: weelayhelper [options]"
    opts.on('-H', '--host hostname', String, 'Hostname of the Weechat instance') do |hn|
      @host = hn
    end
    opts.on('-P', '--password pass', String, 'Password (if needed) of the Weechat relay instance') do |pass|
      @password = pass
    end
    opts.on('-p', '--port port', Integer, 'Port that the Weechat instance is listening on') do |port|
      @port = port
    end
    opts.on('-s', '--[no-]ssl', 'Use SSL when connecting') do |ssl|
      @ssl = ssl
    end
    opts.on('-c', '--[no-]compression', 'Use Zlib to compress communication') do |compression|
      @compression = compression
    end
    opts.on_tail('-h', '--help', 'Shows this help message') do
      puts opts
      exit
    end
  end.parse! args
end

Instance Attribute Details

#compressionObject (readonly)

Returns the value of attribute compression.



4
5
6
# File 'lib/weechat-relay-helper/options.rb', line 4

def compression
  @compression
end

#hostObject (readonly)

Returns the value of attribute host.



4
5
6
# File 'lib/weechat-relay-helper/options.rb', line 4

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/weechat-relay-helper/options.rb', line 4

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



4
5
6
# File 'lib/weechat-relay-helper/options.rb', line 4

def port
  @port
end

#sslObject (readonly)

Returns the value of attribute ssl.



4
5
6
# File 'lib/weechat-relay-helper/options.rb', line 4

def ssl
  @ssl
end