Public: Initialize template with custom options.

 options - Hash
 cache_version - String custom cache version. Used to force a cache
                 change after code changes are made to Sass Functions.
2964
def call(input)
      context = input[:environment].context_class.new(input)

      engine_options = merge_options({
        filename: input[:filename],
        syntax: self.class.syntax,
        cache_store: build_cache_store(input, @cache_version),
        load_paths: context.environment.paths.map { |p| @importer_class.new(p.to_s) },
        importer: @importer_class.new(Pathname.new(context.filename).to_s),
        sprockets: {
          context: context,
          environment: input[:environment],
          dependencies: context.metadata[:dependencies]
        }
      })

      engine = Autoload::Sass::Engine.new(input[:data], engine_options)

      css, map = Utils.module_include(Autoload::Sass::Script::Functions, @functions) do
        engine.render_with_sourcemap('')
      end

      css = css.sub("\n/*# sourceMappingURL= */\n", '')

      map = SourceMapUtils.format_source_map(JSON.parse(map.to_json(css_uri: '')), input)
      map = SourceMapUtils.combine_source_maps(input[:metadata][:map], map)

      # Track all imported files
      sass_dependencies = Set.new([input[:filename]])
      engine.dependencies.map do |dependency|
        sass_dependencies << dependency.options[:filename]
        context.metadata[:dependencies] << URIUtils.build_file_digest_uri(dependency.options[:filename])
      end

      context.metadata.merge(data: css, sass_dependencies: sass_dependencies, map: map)
    end
1286208
def merge_custom_defaults!
      dotfile = File.join(ENV["HOME"], ".aprc")
      load dotfile if File.readable?(dotfile)
      merge_options!(AwesomePrintLite.defaults) if AwesomePrintLite.defaults.is_a?(Hash)
    rescue => e
      $stderr.puts "Could not load #{dotfile}: #{e}"
    end
445086
def merge_template_options(default_options, template_key, custom_options = {})
      template_options = configuration.template_options.fetch template_key, {}
      options = Wingtips::HashUtils.deep_merge(default_options, template_options)
      Wingtips::HashUtils.deep_merge(options, custom_options)
    end
235496
def C_Initialize(args=nil)
      case args
        when Hash
          pargs = CK_C_INITIALIZE_ARGS.new
          args.each{|k,v| pargs.send("#{k}=", v) }
        else
          pargs = args
      end
      unwrapped_C_Initialize(pargs)
    end
121638
protected void initCacheObject() {

        CmsFlexController controller = (CmsFlexController)getJsp().getRequest().getAttribute(
            CmsFlexController.ATTRIBUTE_NAME);
        CmsFlexCache cache = controller.getCmsCache();

        setVariations("" + cache.size());
        setKeys("" + cache.keySize());
        CmsLruCache entryLruCache = cache.getEntryLruCache();

        if (entryLruCache != null) {
            Locale locale = getLocale();
            setMaxSize(CmsFileUtil.formatFilesize(entryLruCache.getMaxCacheCosts(), locale));
            setAvgSize(CmsFileUtil.formatFilesize(entryLruCache.getAvgCacheCosts(), locale));
            setCurSize(CmsFileUtil.formatFilesize(entryLruCache.getObjectCosts(), locale));
        }
    }
266559
def init_hash(hash)
    if hash[:parser]
      self.parser=hash[:parser]
    elsif hash[:many]
      init_many hash
    elsif hash[:match]
      init hash[:match]
    elsif hash[:any]
      init_any hash[:any]
    else
      raise "extended-options patterns (specified by a hash) must have either :parser=> or a :match=> set"
    end

    self.name = hash[:as] || self.name
    self.optional ||= hash[:optional] || hash[:optionally]
    self.could_match ||= hash[:could]
    self.negative ||= hash[:dont]
  end
1195332
def _render_template(options)
        variant = options.delete(:variant)
        assigns = options.delete(:assigns)
        context = view_context

        context.assign assigns if assigns
        lookup_context.variants = variant if variant

        rendered_template = context.in_rendering_context(options) do |renderer|
          renderer.render_to_object(context, options)
        end

        rendered_format = rendered_template.format || lookup_context.formats.first
        @rendered_format = Template::Types[rendered_format]

        rendered_template.body
      end
980028
def cache(key, options = {}, &block) # :doc:
        if cache_configured?
          cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, :controller), options, &block)
        else
          yield
        end
      end
1132355
function loadTemplate (file, options) {
    // return cached template if caching enabled
    if (options.cache && GLOBAL.templates[file]) {
        return Promise.resolve(GLOBAL.templates[file])
    }
    // store promise to load template
    var promise = GLOBAL.templates[file] = fsp.readFile(file, 'utf8')
    // compile template file
    .then(data => {
        // replace entry in template cache with template function
        var template = GLOBAL.templates[file] = handlebars.compile(data)
        // resolve with template
        return template
    })
    // return promise
    return promise
}
95934
public static function prepopulate_versionnumber_cache($class, $stage, $idList = null)
    {
        ReadingMode::validateStage($stage);
        if (!Config::inst()->get(static::class, 'prepopulate_versionnumber_cache')) {
            return;
        }

        /** @var Versioned|DataObject $singleton */
        $singleton = DataObject::singleton($class);
        $baseClass = $singleton->baseClass();
        $baseTable = $singleton->baseTable();
        $stageTable = $singleton->stageTable($baseTable, $stage);

        $filter = "";
        $parameters = [];
        if ($idList) {
            // Validate the ID list
            foreach ($idList as $id) {
                if (!is_numeric($id)) {
                    user_error(
                        "Bad ID passed to Versioned::prepopulate_versionnumber_cache() in \$idList: " . $id,
                        E_USER_ERROR
                    );
                }
            }
            $filter = 'WHERE "ID" IN (' . DB::placeholders($idList) . ')';
            $parameters = $idList;

        // If we are caching IDs for _all_ records then we can mark this cache as "complete" and in the case of a cache-miss
        // no subsequent call is necessary
        } else {
            self::$cache_versionnumber[$baseClass][$stage] = [ '_complete' => true ];
        }

        $versions = DB::prepared_query("SELECT \"ID\", \"Version\" FROM \"$stageTable\" $filter", $parameters)->map();

        foreach ($versions as $id => $version) {
            self::$cache_versionnumber[$baseClass][$stage][$id] = $version;
        }
    }
393266
def get_template(filename_or_string, is_string=False):
    '''
    
    '''

    # Cache against string sha or just the filename
    cache_key = sha1_hash(filename_or_string) if is_string else filename_or_string

    if cache_key in TEMPLATES:
        return TEMPLATES[cache_key]

    if is_string:
        # Set the input string as our template
        template_string = filename_or_string

    else:
        # Load template data into memory
        with open(filename_or_string, 'r') as file_io:
            template_string = file_io.read()

    TEMPLATES[cache_key] = Template(template_string, keep_trailing_newline=True)
    return TEMPLATES[cache_key]
746765
def get_template_setting(template_key, default=None):
    
    templates_var = getattr(settings, 'TEMPLATES', None)
    if templates_var:
        for tdict in templates_var:
            if template_key in tdict:
                return tdict[template_key]
    return default
1304298
def config_option(name, default_value, options = {})
      compiler      = options.fetch(:compiler_option, nil)
      valid_values  = options.fetch(:valid_values, [true, false])

      config_options[name] = {
        default: default_value,
        compiler: compiler
      }

      define_singleton_method(name) { config.fetch(name, default_value) }
      define_singleton_method("#{name}=") do |value|
        unless valid_values.any? { |valid_value| valid_value === value }
          raise ArgumentError, "Not a valid value for option #{self}.#{name}, provided #{value.inspect}. "\
                               "Must be #{valid_values.inspect} === #{value.inspect}"
        end

        config[name] = value
      end
    end
1018935
def initialize_constants!
      @initialize_constants ||= begin
        class_const = options[:class] || @name.to_s.camelize
        class_const = class_const.constantize if class_const.is_a?(String)
        options[:class] = class_const

        if options[:builder]
          options[:builder] = options[:builder].constantize if options[:builder].is_a?(String)
        end

        true
      end
      
      unless Mutations.cache_constants?
        options[:class] = options[:class].to_s.constantize if options[:class]
        options[:builder] = options[:builder].to_s.constantize if options[:builder]
      end
    end
1094882
def custom_render_template(template_name_or_list, **context):
    
    response_str = render_template(
        functools.reduce(lambda x, y: x + [os.path.join('custom', y), y],
                         to_list(template_name_or_list), []),
        **context
    )
    if hasattr(g, 'status_code'):
        status_code = g.status_code
    else:
        status_code = 200
    return response_str, status_code
703395
def cache_options(sql = nil)
      options = Influxer.config.cache.dup
      options[:expires_in] = (options[:cache_now_for] || 60) if sql =~ /\snow\(\)/
      options
    end
854249
def options
      map = ChefAPI::Configurable.keys.map do |key|
        [key, instance_variable_get(:"@#{key}")]
      end
      Hash[map]
    end