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

Version Path
mongodb_logger-0.6.5 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.6.4 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.6.3 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.6.2 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.6.1 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.6.0 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.5.2 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.5.1 lib/mongodb_logger/server/model/base.rb
mongodb_logger-0.5.0 lib/mongodb_logger/server/model/base.rb