Module: Setsuzoku::HasConfigContext

Extended by:
T::Helpers, T::Sig
Included in:
ApiStrategy, AuthStrategy
Defined in:
lib/setsuzoku/has_config_context.rb

Overview

Set of methods/functionality for managing a classes config_context

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_contextObject

Returns the value of attribute config_context.



10
11
12
# File 'lib/setsuzoku/has_config_context.rb', line 10

def config_context
  @config_context
end

Instance Method Details

#get_from_context(method) ⇒ Any

Retrieve a value from config_context or call the default method implementation for the class.

Returns:

  • (Any)

    the value of the key in config_context, or return value of the method.



19
20
21
22
23
24
25
# File 'lib/setsuzoku/has_config_context.rb', line 19

def get_from_context(method)
  if self.config_context.key?(method)
    self.get_registered_instance_val(method)
  else
    self.send(method) if self.respond_to?(method)
  end
end