Class: ActiveZone::Zone

Inherits:
Object
  • Object
show all
Defined in:
lib/active_zone/zone.rb

Overview

Proxy class for easily accessing Provider::Zone at the current Provider

See Also:

Defined Under Namespace

Modules: Builtins

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**attributes) ⇒ Zone

Returns a new instance of Zone.

Parameters:



5
6
7
# File 'lib/active_zone/zone.rb', line 5

def initialize(**attributes)
  @zone = ActiveZone.provider.Zone.new(**attributes)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object

Delegate to Provider::Zone



10
11
12
# File 'lib/active_zone/zone.rb', line 10

def method_missing(method_name, *, &)
  @zone.send(method_name, *, &)
end

Class Method Details

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

Delegate class methods to current [Provider::Zone]



21
22
23
24
25
# File 'lib/active_zone/zone.rb', line 21

def self.method_missing(method_name, *arguments, &block)
  ActiveZone.provider.Zone.with_provider(ActiveZone.provider) do |z|
    z.send(method_name, *arguments, &block)
  end
end

.respond_to_missing?(method_name, include_private = false) ⇒ TrueClass, FalseClass

Delegate class methods to current [Provider::Zone]

Returns:

  • (TrueClass)

    if true

  • (FalseClass)

    if false



29
30
31
# File 'lib/active_zone/zone.rb', line 29

def self.respond_to_missing?(method_name, include_private = false)
  ActiveZone.provider.Zone.respond_to?(method_name, include_private)
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ TrueClass, FalseClass

Delegate to Provider::Zone

Returns:

  • (TrueClass)

    if true

  • (FalseClass)

    if false



16
17
18
# File 'lib/active_zone/zone.rb', line 16

def respond_to_missing?(method_name, include_private = false)
  @zone.respond_to?(method_name, include_private)
end