Class: FastExt::MModel
- Inherits:
-
Object
- Object
- FastExt::MModel
- Defined in:
- lib/fast_ext/m_model.rb
Class Method Summary collapse
Instance Method Summary collapse
- #columns ⇒ Object
-
#initialize(model) ⇒ MModel
constructor
A new instance of MModel.
- #name ⇒ Object
Constructor Details
#initialize(model) ⇒ MModel
Returns a new instance of MModel.
6 7 8 |
# File 'lib/fast_ext/m_model.rb', line 6 def initialize(model) @model = model end |
Class Method Details
.all ⇒ Object
18 19 20 |
# File 'lib/fast_ext/m_model.rb', line 18 def self.all @@models ||= ::ActiveRecord::Base.subclasses.map {|ar| MModel.new(ar)} end |
.find(class_name) ⇒ Object
22 23 24 |
# File 'lib/fast_ext/m_model.rb', line 22 def self.find(class_name) all.detect {|m| m.class.to_s == class_name.to_s } end |
Instance Method Details
#columns ⇒ Object
14 15 16 |
# File 'lib/fast_ext/m_model.rb', line 14 def columns @model.columns end |
#name ⇒ Object
10 11 12 |
# File 'lib/fast_ext/m_model.rb', line 10 def name @model.to_s end |