class Object

Public Instance Methods

_cache_key(key, options) click to toggle source
# File lib/turbostreamer/template.rb, line 198
def _cache_key(key, options)
  name_options = options.slice(:skip_digest, :virtual_path)
  key = _fragment_name_with_digest(key, name_options)

  if @context.respond_to?(:combined_fragment_cache_key)
    key = @context.combined_fragment_cache_key(key)
  elsif @context.respond_to?(:fragment_cache_key)
    # TODO: remove after droping rails 5.1 support
    key = @context.fragment_cache_key(key)
  elsif ::Hash === key
    key = url_for(key).split('://', 2).last
  end

  ::ActiveSupport::Cache.expand_cache_key(key, :streamer)
end
_eachable_arguments?(value, *args) click to toggle source
Calls superclass method
# File lib/turbostreamer/template.rb, line 235
def _eachable_arguments?(value, *args)
  return true if super
  options = args.last
  ::Hash === options && options.key?(:as)
end
_fragment_name_with_digest(key, options) click to toggle source
# File lib/turbostreamer/template.rb, line 214
def _fragment_name_with_digest(key, options)
  if @context.respond_to?(:cache_fragment_name)
    # Current compatibility, fragment_name_with_digest is private again and cache_fragment_name
    # should be used instead.
    @context.cache_fragment_name(key, options)
  elsif @context.respond_to?(:fragment_name_with_digest)
    # Backwards compatibility for period of time when fragment_name_with_digest was made public.
    @context.fragment_name_with_digest(key)
  else
    key
  end
end
_is_active_model?(object) click to toggle source
# File lib/turbostreamer/template.rb, line 231
def _is_active_model?(object)
  object.class.respond_to?(:model_name) && object.respond_to?(:to_partial_path)
end
_partial_options?(options) click to toggle source
# File lib/turbostreamer/template.rb, line 227
def _partial_options?(options)
  ::Hash === options && options.key?(:as) && options.key?(:partial)
end