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
-
.[](klass) ⇒ Object
Public: Reader method for accessing the Arca::Model for analysis and reporting.
-
.relative_path(path) ⇒ Object
Public: Helper method for turning absolute paths into relative paths.
-
.root_path ⇒ Object
Public: String representing the root path for the project.
-
.root_path=(path) ⇒ Object
Public: Writer method for configuring the root path of the project where Arca is being used.
Class Method Details
.[](klass) ⇒ Object
Public: Reader method for accessing the Arca::Model for analysis and reporting.
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 |
.relative_path(path) ⇒ Object
Public: Helper method for turning absolute paths into relative paths.
path - String absolute path.
Returns a relative path String.
43 44 45 46 47 48 49 50 51 |
# File 'lib/arca.rb', line 43 def self.relative_path(path) return if path.nil? if root_path path.sub(/^#{Regexp.escape(root_path) || ""}\//, "") else path end end |
.root_path ⇒ Object
Public: String representing the root path for the project.
34 35 36 |
# File 'lib/arca.rb', line 34 def self.root_path @root_path ||= Dir.pwd end |
.root_path=(path) ⇒ Object
Public: 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 |