Class: Ridley::Context Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ridley/context.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, connection) ⇒ Context

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Context.

Parameters:

  • resource (Constant)

    the constant of the class to send class functions to

  • connection (Ridley::Connection)

    the connection to use when sending class functions to resources



12
13
14
15
# File 'lib/ridley/context.rb', line 12

def initialize(resource, connection)
  @resource = resource
  @connection = connection
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(fun, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
# File 'lib/ridley/context.rb', line 21

def method_missing(fun, *args, &block)
  resource.send(fun, connection, *args, &block)
end

Instance Attribute Details

#connectionObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



6
7
8
# File 'lib/ridley/context.rb', line 6

def connection
  @connection
end

#resourceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
# File 'lib/ridley/context.rb', line 5

def resource
  @resource
end

Instance Method Details

#new(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
# File 'lib/ridley/context.rb', line 17

def new(*args)
  resource.send(:new, connection, *args)
end