module Arca
Public Class Methods
[](klass)
click to toggle source
Public: Reader method for accessing the Arca::Model
for analysis and reporting.
# 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)
click to toggle source
Public: Helper method for turning absolute paths into relative paths.
path - String absolute path.
Returns a relative path String.
# 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()
click to toggle source
Public: String representing the root path for the project.
# File lib/arca.rb, line 34 def self.root_path @root_path ||= Dir.pwd end
root_path=(path)
click to toggle source
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.
# File lib/arca.rb, line 29 def self.root_path=(path) @root_path = path.to_s end