Module: HasDictionary::ClassMethods

Defined in:
lib/has_dictionary/has_dictionary.rb

Instance Method Summary collapse

Instance Method Details

#has_dictionary(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/has_dictionary/has_dictionary.rb', line 8

def has_dictionary(options = {})
  class_attribute :dic_options

  self.dic_options = options

  define_method(dic_options[:method]) {
    eval "#{dic_options[:dic_class]}.get self.#{dic_options[:field]}"
  }
end