Class: ParamsBase

Inherits:
Object
  • Object
show all
Defined in:
lib/models.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ ParamsBase

Returns a new instance of ParamsBase.



2
3
4
# File 'lib/models.rb', line 2

def initialize params
  params.each { |k, v| send "#{k}=", v }
end

Instance Method Details

#to_hashObject



6
7
8
9
10
11
12
# File 'lib/models.rb', line 6

def to_hash
	hash = {}
	self.instance_variables.each do |var| 
		hash[var.to_s.delete("@")] = self.instance_variable_get(var) 
	end
	hash
end