Module: Ramverk::Configuration::DynamicGroups

Included in:
Ramverk::Configuration
Defined in:
lib/ramverk/configuration/dynamic_groups.rb

Overview

Module for creating configuration items on the fly.

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



8
9
10
11
12
13
14
15
# File 'lib/ramverk/configuration/dynamic_groups.rb', line 8

def method_missing(meth, *args, &block)
  return super unless meth.to_s.end_with?("=")

  key = meth.to_s.sub("=", "")
  dynamic_groups[key] = args.first

  define_singleton_method(key) { dynamic_groups[key] }
end