Class: Focus::ContextualConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/focus/action.rb

Overview

A small wrapper to an Action’s context. If an attribute is defined in the context, it will be returned. Otherwise, a lookup within Focus::Config will take place.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ ContextualConfiguration

Returns a new instance of ContextualConfiguration.



13
14
15
# File 'lib/focus/action.rb', line 13

def initialize(context)
  @context = context
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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

rubocop:disable MethodMissing



17
18
19
# File 'lib/focus/action.rb', line 17

def method_missing(m, *args, &block) # rubocop:disable MethodMissing
  context.send(m) || Config.send(m, *args, &block)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



11
12
13
# File 'lib/focus/action.rb', line 11

def context
  @context
end