instance method find_root_with_flag

Ruby on Rails 3.2.22.5

Since v3.1.12 Last seen in v3.2.22.5

Available in: v3.1.12 v3.2.22.5

Signature

find_root_with_flag(flag, default=nil)

No documentation comment.

Parameters

flag req
default opt = nil
Source
# File railties/lib/rails/engine.rb, line 631
    def find_root_with_flag(flag, default=nil)
      root_path = self.class.called_from

      while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
        parent = File.dirname(root_path)
        root_path = parent != root_path && parent
      end

      root = File.exist?("#{root_path}/#{flag}") ? root_path : default
      raise "Could not find root path for #{self}" unless root

      RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ?
        Pathname.new(root).expand_path : Pathname.new(root).realpath
    end

Defined in railties/lib/rails/engine.rb line 631 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Engine

Type at least 2 characters to search.

↑↓ navigate · open · esc close