Skip to content

Commit

Permalink
extract regiser_engine3/register_engine4
Browse files Browse the repository at this point in the history
  • Loading branch information
hanachin committed Jun 20, 2016
1 parent 0e3e8fb commit 43bb1d1
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions lib/slim-rails/register_engine.rb
Expand Up @@ -3,15 +3,25 @@ module Rails
module RegisterEngine
def self.register_engine(app, config)
if ::Rails::VERSION::MAJOR == 3
if app.assets && app.assets.respond_to?(:register_engine)
app.assets.register_engine('.slim', Slim::Template)
end
register_engine3(app, config)
else
config.assets.configure do |env|
env.register_engine('.slim', Slim::Template)
end if config.respond_to?(:assets)
register_engine4(app, config)
end
end

private

def self.register_engine3(app, _config)
if app.assets && app.assets.respond_to?(:register_engine)
app.assets.register_engine('.slim', Slim::Template)
end
end

def self.register_engine4(_app, config)
config.assets.configure do |env|
env.register_engine('.slim', Slim::Template)
end if config.respond_to?(:assets)
end
end
end
end

0 comments on commit 43bb1d1

Please sign in to comment.