Class: Servies::OperationFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/servies/operation_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(namespace, backend, autocall = false) ⇒ OperationFinder

Returns a new instance of OperationFinder.



7
8
9
10
11
# File 'lib/servies/operation_finder.rb', line 7

def initialize(namespace, backend, autocall = false)
  @namespace = namespace
  @backend   = backend
  @autocall  = autocall
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, attributes = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/servies/operation_finder.rb', line 13

def method_missing(name, attributes = {})
  klass    = _find_klass(name)
  instance = klass.new(attributes.merge(backend: backend))

  if @autocall
    instance.call
  else
    instance
  end
end

Instance Attribute Details

#backendObject (readonly)

Returns the value of attribute backend.



5
6
7
# File 'lib/servies/operation_finder.rb', line 5

def backend
  @backend
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



5
6
7
# File 'lib/servies/operation_finder.rb', line 5

def namespace
  @namespace
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/servies/operation_finder.rb', line 24

def respond_to_missing?(name, include_private = false)
  _find_klass(name)
end