search for: _set_detail

Displaying 1 result from an estimated 1 matches for "_set_detail".

2012 Sep 11
1
define_method vs module_eval
...rs.send :define_method, :"default_#{name}", &block Accessors.module_eval <<-METHOD, __FILE__, __LINE__ + 1    def #{name}    -ISKimRw02aC5oVgD8gxYQQ@public.gmane.org(:#{name}, [])    end    def #{name}=(value)    value = value.present? ? Array(value) : default_#{name}    _set_detail(:#{name}, value) if value != @details[:#{name}]    end    remove_possible_method :initialize_details    def initialize_details(details)    #{initialize.join("\n")}    end    METHOD end Here we invoke send() on the module Accessors, passing the :define_method symbol, which represen...