Module: ActiveYaml::MethodMapping

Included in:
BaseModel, ClassMethods
Defined in:
lib/active_yaml/method_mapping.rb

Overview

A module containing methods that allow you to track method calls, and compare them with data from the YML file

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/active_yaml/method_mapping.rb', line 9

def method_missing(method, *args, &block)
  value = yaml_data[method.to_s]

  if value
    return value unless value.is_a?(Hash)

    YamlHash.new(value)
  else
    super
  end
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/active_yaml/method_mapping.rb', line 21

def respond_to_missing?(method, include_private = false)
  yaml_data[method.to_s] || super
end