Class: Twig::Rails::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/twig/rails/config.rb

Class Method Summary collapse

Class Method Details

.currentObject



26
27
28
# File 'lib/twig/rails/config.rb', line 26

def self.current
  self.configuration ||= defaults
end

.defaultsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/twig/rails/config.rb', line 6

def self.defaults
  ActiveSupport::OrderedOptions.new.merge!({
    root: ::Rails.root,
    paths: %w[./ app/views/],
    debug: ::Rails.env.development?,
    allow_helper_methods: true,
    cache: ::Rails.root.join('tmp/cache/twig').to_s,
    charset: 'UTF-8',
    strict_variables: true,
    autoescape: :name,
    auto_reload: nil,
    loader: lambda do
      ::Twig::Loader::Filesystem.new(
        current.root,
        current.paths
      )
    end,
  })
end