Module: LazyRecord::BaseModule
- Included in:
- Base
- Defined in:
- lib/lazy_record/base_module.rb
Overview
This module gives the Base class its functionality, and can be included in any class as an alternative to inheriting from LazyRecord::Base
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
- #id ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #has_one_associations_to_s ⇒ Object
- #initialize(opts = {}) {|_self| ... } ⇒ Object
- #inspect ⇒ Object
Instance Attribute Details
#id ⇒ Object
50 51 52 |
# File 'lib/lazy_record/base_module.rb', line 50 def id @id.freeze end |
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lazy_record/base_module.rb', line 7 def self.included(base) base.extend ClassMethods base.extend Scopes base.extend Attributes base.extend Associations base.extend Callbacks base.extend Validations base.extend Methods base.extend DynamicModules end |
Instance Method Details
#has_one_associations_to_s ⇒ Object
39 40 41 |
# File 'lib/lazy_record/base_module.rb', line 39 def has_one_associations_to_s [] end |
#initialize(opts = {}) {|_self| ... } ⇒ Object
20 21 22 23 24 25 |
# File 'lib/lazy_record/base_module.rb', line 20 def initialize(opts = {}) opts.each do |k, v| send("#{k}=", v) if respond_to?("#{k}=") end yield self if block_given? end |
#inspect ⇒ Object
43 44 45 46 47 48 |
# File 'lib/lazy_record/base_module.rb', line 43 def inspect "#<#{self.class} id: #{id ? id : 'nil'}"\ "#{instance_attrs_to_s.unshift('').join(', ')}"\ "#{has_one_associations_to_s.unshift('').join(', ')}"\ "#{collection_counts_to_s.unshift('').join(', ')}>" end |