lib/lokalise_rails/utils.rb in lokalise_rails-4.0.0 vs lib/lokalise_rails/utils.rb in lokalise_rails-5.0.0
- old
+ new
@@ -1,15 +1,18 @@
# frozen_string_literal: true
require 'pathname'
module LokaliseRails
+ # Util methods
module Utils
class << self
+ # Current project root
def root
Pathname.new(rails_root || Dir.getwd)
end
+ # Tries to get Rails root if Rails is defined
def rails_root
return ::Rails.root.to_s if defined?(::Rails.root) && ::Rails.root
return RAILS_ROOT.to_s if defined?(RAILS_ROOT)
nil