Class: MongodbLogger::ServerModel::Base
- Inherits:
-
Object
- Object
- MongodbLogger::ServerModel::Base
show all
- Defined in:
- lib/mongodb_logger/server/model/base.rb
Instance Method Summary
collapse
Instance Method Details
#create_variable(k, v) ⇒ Object
13
14
15
16
17
|
# File 'lib/mongodb_logger/server/model/base.rb', line 13
def create_variable(k, v)
self.instance_variable_set("@#{k}", v) self.class.send(:define_method, k, proc{self.instance_variable_get("@#{k}")}) self.class.send(:define_method, "#{k}=", proc{|v| self.instance_variable_set("@#{k}", v)}) end
|
#set_params_to_methods ⇒ Object
7
8
9
10
11
|
# File 'lib/mongodb_logger/server/model/base.rb', line 7
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
|