Class: RbsActiverecord::Model
- Inherits:
-
Object
- Object
- RbsActiverecord::Model
- Extended by:
- Forwardable
- Defined in:
- lib/rbs_activerecord/model.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
: singleton(ActiveRecord::Base).
Instance Method Summary collapse
-
#filename ⇒ Object
: String.
-
#initialize(klass) ⇒ Model
constructor
A new instance of Model.
-
#parents ⇒ Object
: Array.
Constructor Details
#initialize(klass) ⇒ Model
Returns a new instance of Model.
20 21 22 |
# File 'lib/rbs_activerecord/model.rb', line 20 def initialize(klass) #: void @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
: singleton(ActiveRecord::Base)
9 10 11 |
# File 'lib/rbs_activerecord/model.rb', line 9 def klass @klass end |
Instance Method Details
#filename ⇒ Object
: String
24 25 26 |
# File 'lib/rbs_activerecord/model.rb', line 24 def filename #: String "app/models/#{klass.name.to_s.underscore}.rb" end |
#parents ⇒ Object
: Array
28 29 30 31 |
# File 'lib/rbs_activerecord/model.rb', line 28 def parents #: Array[singleton(ActiveRecord::Base)] ancestors = klass.ancestors #: Array[singleton(ActiveRecord::Base)] ancestors.select { |cls| cls < ActiveRecord::Base && cls != klass && !cls.abstract_class? } end |