Class: Kodi::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/kodi/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, name, *methods) ⇒ Namespace

Returns a new instance of Namespace.



5
6
7
8
9
# File 'lib/kodi/namespace.rb', line 5

def initialize(uri, name, *methods)
  @uri = uri
  @name = name
  @methods = methods
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/kodi/namespace.rb', line 11

def method_missing(method_name, *arguments, &block)
  if method = find_method(method_name)
    RPC.new(uri).dispatch(name + '.' + method.name, *arguments)
  else
    super
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/kodi/namespace.rb', line 3

def name
  @name
end

#uriObject (readonly)

Returns the value of attribute uri.



3
4
5
# File 'lib/kodi/namespace.rb', line 3

def uri
  @uri
end