Sha256: 3281dc8213b4b6a25f9fe1e2ffdc10aa555e7a02f747ef5a75fe05a5309ef46d
Contents?: true
Size: 1.13 KB
Versions: 28
Compression:
Stored size: 1.13 KB
Contents
require 'fiona7/mode_switch/abstract_mode_switch' module Fiona7 module ModeSwitch class Views < AbstractModeSwitch def standalone self.reorder_view_paths(self.scrivito_sdk_path, self.fiona_connector_path) end def legacy self.reorder_view_paths(self.fiona_connector_path, self.scrivito_sdk_path) end protected def scrivito_sdk_path Gem.loaded_specs['scrivito_sdk'].full_name end def fiona_connector_path Gem.loaded_specs['infopark_fiona_connector'].full_name end def reorder_view_paths(first, second) view_paths = ActionController::Base.view_paths paths = view_paths.map(&:to_s) internal_paths = view_paths.send(:paths) first_index = paths.index {|path| path =~ /#{Regexp.escape first}\/app\/views/ } second_index = paths.index {|path| path =~ /#{Regexp.escape second}\/app\/views/ } if first_index > second_index internal_paths[first_index], internal_paths[second_index] = internal_paths[second_index], internal_paths[first_index] end end end end end
Version data entries
28 entries across 28 versions & 1 rubygems