Class: Devlog::Settings

Inherits:
Hash
  • Object
show all
Defined in:
lib/devlog_settings.rb

Overview

Settings - keeping it simple. Allow settings.key besides settings If the method name exists as a key within this Hash, fetch it.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



15
16
17
18
19
20
21
22
23
# File 'lib/devlog_settings.rb', line 15

def method_missing(m, *args, &block)
  if key?(m)
    fetch m
  elsif key?(m.to_s)
    fetch m.to_s
  else
    super
  end
end

Instance Method Details

#has?(m) ⇒ Boolean

Returns:

  • (Boolean)


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

def has?(m)
  return key?(m) || key?(m.to_s)
end