Class: Itchy::VmcatcherConfiguration

Inherits:
VmcatcherEnv show all
Defined in:
lib/itchy/vmcatcher_configuration.rb

Overview

Wraps vmcatcher configuration meta data.

Constant Summary collapse

KNOWN_METHOD_NAMES =

Known methods names used by this class

%w(
rdbms
cache_event
log_conf
dir_cert
cache_dir_cache
cache_dir_download
cache_dir_expire
cache_action_download
cache_action_check
cache_action_expire).freeze
VMCATCHER_ATTR_PREFIX =

Prefix for making vmcatcher attributes

'VMCATCHER_'
REGISTERED_ENV_KEYS =

Known vmcatcher configuration attributes

%w(
VMCATCHER_RDBMS
VMCATCHER_CACHE_EVENT
VMCATCHER_LOG_CONF
VMCATCHER_DIR_CERT
VMCATCHER_CACHE_DIR_CACHE
VMCATCHER_CACHE_DIR_DOWNLOAD
VMCATCHER_CACHE_DIR_EXPIRE
VMCATCHER_CACHE_ACTION_DOWNLOAD
VMCATCHER_CACHE_ACTION_CHECK
VMCATCHER_CACHE_ACTION_EXPIRE).freeze

Instance Attribute Summary

Attributes inherited from VmcatcherEnv

#attributes

Instance Method Summary collapse

Methods inherited from VmcatcherEnv

from_json, #initialize, #to_hash, #to_json, #to_pretty_json

Constructor Details

This class inherits a constructor from Itchy::VmcatcherEnv

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *arguments, &block) ⇒ Object

class_eval %Q| def #Itchy::VmcatcherConfiguration.short_env_keyshort_env_key.downcase

attributes["#{registered_env_key}"]

end |

end


42
43
44
45
46
47
48
49
50
51
52
# File 'lib/itchy/vmcatcher_configuration.rb', line 42

def method_missing(method_id, *arguments, &block)
  if KNOWN_METHOD_NAMES.include? method_id.to_s
    self.class.send :define_method, method_id do
      temp = VMCATCHER_ATTR_PREFIX + method_id.to_s.upcase
      attributes["#{temp}"]
    end
    send(method_id)
  else
    super
  end
end

Instance Method Details

#respond_to?(method_id, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
57
58
59
60
# File 'lib/itchy/vmcatcher_configuration.rb', line 54

def respond_to?(method_id, include_private = false)
  if KNOWN_METHOD_NAMES.include? method_id.to_s
    true
  else
    super
  end
end