Sha256: 8f83bcb19f650e6682ef62ab52d756535a92655d28d4c6eaea62e6dbce5ca929
Contents?: true
Size: 651 Bytes
Versions: 9
Compression:
Stored size: 651 Bytes
Contents
require 'date' module MongodbLogger module ServerModel class Base def set_params_to_methods @params.each do |k,v| self.send("#{k}=", v) if self.respond_to?(k) && v && !v.blank? end unless @params.blank? end def create_variable(k, v) self.instance_variable_set("@#{k}", v) ## create instance variable self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")}) ## method to return instance variable self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)}) ## method to set instance variable end end end end
Version data entries
9 entries across 9 versions & 1 rubygems