Class: Encryption::Configuration::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration/base.rb

Direct Known Subclasses

Symmetric

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



5
6
7
# File 'lib/configuration/base.rb', line 5

def initialize
  @config = { }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/configuration/base.rb', line 13

def method_missing(name, *args)
    
  return @config[name.to_sym] if is_valid_getter(name)
  return @config[name[0..-2].to_sym] = args[0] if is_valid_setter(name)

  super
end

Instance Method Details

#config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



9
10
11
# File 'lib/configuration/base.rb', line 9

def config
  yield self
end

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/configuration/base.rb', line 21

def respond_to?(name)
  return true if is_valid_getter(name) or is_valid_setter(name)
  super
end