Class: SO2DB::Models::Lookup

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

Overview

Infrastructure. Do not call this from your code.

Constant Summary collapse

@@map =
{ "badges" => :Badge, "comments" => :Comment,
"posthistory" => :PostHistory, "posts" => :Post, "users" => :User,
"votes" => :Vote, "postlinks" => :PostLink, "tags" => :Tag }

Class Method Summary collapse

Class Method Details

.find_class(file_name) ⇒ Object



106
107
108
# File 'lib/so2db/models.rb', line 106

def self.find_class(file_name)
  Object.const_get("SO2DB::Models::#{@@map[file_name].to_s}")
end

.get_required_attrs(file_name) ⇒ Object



110
111
112
113
# File 'lib/so2db/models.rb', line 110

def self.get_required_attrs(file_name)
  raw = find_class(file_name).send :exported_fields
  return raw.map {|f| f.to_s.camelize.sub(/Guid/, 'GUID')}
end