Module: Arca

Defined in:
lib/arca.rb,
lib/arca/model.rb,
lib/arca/report.rb,
lib/arca/collector.rb,
lib/arca/callback_analysis.rb

Defined Under Namespace

Modules: Collector Classes: CallbackAnalysis, CallbackDataMissing, ClassRequired, Model, Report

Class Method Summary collapse

Class Method Details

.[](klass) ⇒ Object

Public: Reader method for accessing the Arca::Model for analysis and reporting.

Raises:



16
17
18
19
20
21
# File 'lib/arca.rb', line 16

def self.[](klass)
  raise ClassRequired unless klass.kind_of?(Class)
  raise CallbackDataMissing unless klass.respond_to?(:arca_callback_data)

  Arca::Model.new(klass)
end

.model_root_pathObject

Public: String representing the path to the models for the project.



46
47
48
# File 'lib/arca.rb', line 46

def self.model_root_path
  @model_root_path
end

.model_root_path=(path) ⇒ Object

Public: (required) Writer method for configuring the root path to the models for the project where Arca is being used. This path is required by the Arca::Collector for finding the correct line in the caller Array.



41
42
43
# File 'lib/arca.rb', line 41

def self.model_root_path=(path)
  @model_root_path = path.to_s
end

.relative_path(path) ⇒ Object

Public: Helper method for turning absolute paths into relative paths.

path - String absolute path.

Returns a relative path String.



55
56
57
58
59
60
61
62
63
# File 'lib/arca.rb', line 55

def self.relative_path(path)
  return if path.nil?

  if @root_path
    path.sub(/^#{Regexp.escape(@root_path) || ""}\//, "")
  else
    path
  end
end

.root_pathObject

Public: String representing the root path for the project.



34
35
36
# File 'lib/arca.rb', line 34

def self.root_path
  @root_path
end

.root_path=(path) ⇒ Object

Public: (optional) Writer method for configuring the root path of the project where Arca is being used. Setting Arca.root_path will makes inspecting analyzed callbacks easier by shortening absolute paths to relative paths.

path - Pathname or String representing the root path of the project.



29
30
31
# File 'lib/arca.rb', line 29

def self.root_path=(path)
  @root_path = path.to_s
end