Class: KDomain::RailsCodeExtractor::ExtractModel

Inherits:
Object
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/k_domain/rails_code_extractor/extract_model.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(load_shim) ⇒ ExtractModel

Returns a new instance of ExtractModel.



13
14
15
16
17
# File 'lib/k_domain/rails_code_extractor/extract_model.rb', line 13

def initialize(load_shim)
  @load_shim = load_shim
  @shims_loaded = false
  @models = []
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



11
12
13
# File 'lib/k_domain/rails_code_extractor/extract_model.rb', line 11

def model
  @model
end

#modelsObject (readonly)

Returns the value of attribute models.



10
11
12
# File 'lib/k_domain/rails_code_extractor/extract_model.rb', line 10

def models
  @models
end

#shims_loadedObject (readonly)

Returns the value of attribute shims_loaded.



9
10
11
# File 'lib/k_domain/rails_code_extractor/extract_model.rb', line 9

def shims_loaded
  @shims_loaded
end

Instance Method Details

#extract(file) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/k_domain/rails_code_extractor/extract_model.rb', line 19

def extract(file)
  load_shims unless shims_loaded

  ActiveRecord.class_info = nil

  load_retry(file, 10, nil)
rescue StandardError => e
  log.exception(e)
end