# EitilSupport EitilSupport provides utility through stand-alone classes and modules. ## EitilSupport::Directory ```ruby require "eitil_support/directory" ``` The EitilSupport::Directory module provides methods which help you introspect your Rails project. ```ruby EitilSupport::Directory.contents(directory='app') # returns all files and subdirectories of a given directory ``` ```ruby EitilSupport::Directory.files(directory='app') # returns all files of a given directory ``` ```ruby EitilSupport::Directory.subdirs(directory='app') # returns all subdirectories of a given directory ``` ```ruby EitilSupport::Directory.lines(directory='app') # returns the total amount of lines of all files of a given directory ``` ## EitilSupport::StackTrace ```ruby require "eitil_support/stacktrace" ``` The classes EitilSupport::Stack and EitilSupport::Call, and the module EitilSupport::Stack::Audit, provide the utility of easily viewing and storing the current stacktrace anywhere in your code – by initializing EitilSupport::Stack: ```ruby stack = EitilSupport::Stack.new ``` ```ruby stack.report # returns the stacktrace as array, with each call being a stringified instance of EitilSupport::Call ``` ```ruby stack.show # pretty prints the stack.report stacktrace ``` ```ruby stack.find # accepts a block to find a specific call ``` You can also store the stacktrace of a record's update action into its audit. In order to do so, you need 1) to include EitilSupport::Stack::Audit into your model, and 2) add a :stacktrace column to your audits through the following migration. ### Migration ```ruby def change add_column :audits, :stacktrace, :text, array: true, default: [] end ```