Class: Dataset::Record::Meta

Inherits:
Object
  • Object
show all
Defined in:
lib/dataset/record/meta.rb

Overview

A mechanism to cache information about an ActiveRecord class to speed things up a bit for insertions, finds, and method generation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(heirarchy, record_class) ⇒ Meta

Returns a new instance of Meta.



14
15
16
17
18
# File 'lib/dataset/record/meta.rb', line 14

def initialize(heirarchy, record_class)
  @heirarchy    = heirarchy
  @record_class = record_class
  @class_name   = record_class.name
end

Instance Attribute Details

#class_nameObject (readonly)

:nodoc:



7
8
9
# File 'lib/dataset/record/meta.rb', line 7

def class_name
  @class_name
end

#heirarchyObject (readonly)

:nodoc:



7
8
9
# File 'lib/dataset/record/meta.rb', line 7

def heirarchy
  @heirarchy
end

#record_classObject (readonly)

:nodoc:



7
8
9
# File 'lib/dataset/record/meta.rb', line 7

def record_class
  @record_class
end

Instance Method Details

#inheriting_record?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/dataset/record/meta.rb', line 20

def inheriting_record?
  !record_class.descends_from_active_record?
end

#to_sObject



24
25
26
# File 'lib/dataset/record/meta.rb', line 24

def to_s
  "#<RecordMeta: #{table_name}>"
end