Class: Jax::Engine

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/jax/engine.rb,
lib/jax/engine/configurable.rb

Direct Known Subclasses

Application, Application::Builtin, Plugin

Defined Under Namespace

Modules: Configurable Classes: Configuration

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.called_fromObject

Returns the value of attribute called_from.



8
9
10
# File 'lib/jax/engine.rb', line 8

def called_from
  @called_from
end

Class Method Details

.find_root_with_flag(flag, default = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jax/engine.rb', line 15

def find_root_with_flag(flag, default=nil)
  root_path = self.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

.inherited(base) ⇒ Object



10
11
12
13
# File 'lib/jax/engine.rb', line 10

def inherited(base)
  base.called_from = detect_caller unless base.abstract_railtie?
  super
end