Class: VLC::System

Inherits:
Object
  • Object
show all
Defined in:
lib/vlc-client/system.rb

Overview

Local Client/Server VLC system

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, options) ⇒ VLC::Server #initializeVLC::Server

Creates a local VLC Client/Server system

Overloads:

  • #initialize(host, port, options) ⇒ VLC::Server

    Examples:

    vlc = VLC::System.new('10.10.0.10', 9000)

    Parameters:

    • host (String)

      The ip to connect to

    • port (Integer)

      the port

    • options (Hash)

    Options Hash (options):

    • :headless (Boolean)

      If true VLC run in headless mode. i.e. without a graphical interface. Defaults to false.

    • :auto_start (Boolean)

      When false, the server lifecycle is not managed automatically and controll is passed to the developer

    • :conn_retries (Integer)

      Number of connection retries (each separated by a second) to make on auto-connect. Defaults to 5.

    • :daemonize (Boolean)

      When true and only when on server auto-start mode, the server will be detached and run as a daemon process. Defaults to false.

  • #initializeVLC::Server

    Examples:

    vlc = VLC::System.new

Raises:


30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vlc-client/system.rb', line 30

def initialize(*args)
  args = NullObject.Null?(args)
  opts = args.extract_options!

  server = VLC::Server.new
  server.headless = opts.fetch(:headless, false)

  if args.size == 2
    server.host = args.first.to_s
    server.port = Integer(args.last)
  end

  @client = VLC::Client.new(server, opts)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (protected)

Delegate to VLC::Client


57
58
59
60
# File 'lib/vlc-client/system.rb', line 57

def method_missing(method, *args, &block)
  return super unless client.respond_to?(method)
  client.send(method, *args, &block)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


4
5
6
# File 'lib/vlc-client/system.rb', line 4

def client
  @client
end

Instance Method Details

#respond_to?(method, private_methods = false) ⇒ Boolean

Returns:

  • (Boolean)

49
50
51
# File 'lib/vlc-client/system.rb', line 49

def respond_to?(method, private_methods = false)
  client.respond_to?(method, private_methods) || super(method, private_methods)
end

#serverObject


45
46
47
# File 'lib/vlc-client/system.rb', line 45

def server
  client.server
end