Module: StringInflection::Method

Instance Method Summary collapse

Instance Method Details

#[](options) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/string_inflection/method.rb', line 3

def [](options)
  name = options[:name]
  mod_name = "NAMES_#{name}"
  return const_get(mod_name) if const_defined?(mod_name)
  mod = Module.new
  const_set mod_name, mod
  mod.__send__ :define_method, name, &@method_definition
  mod
end