Module: RuxRails::LoadPatch

Included in:
Kernel
Defined in:
lib/rux-rails/core_ext/kernel.rb

Instance Method Summary collapse

Instance Method Details

#load(file, *args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rux-rails/core_ext/kernel.rb', line 3

def load(file, *args)
  # ActiveSupport::Dependencies adds an extra .rb to the end
  if file.end_with?('.rux.rb')
    file = file.chomp('.rb')
  end

  if file.end_with?('.rux')
    tmpl = Rux::File.new(file)
    tmpl.write if RuxRails.transpile_on_load?

    return super(tmpl.default_outfile, *args)
  end

  super(file, *args)
end