Class: TheForce::RemoteInclude

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/the_force/remote_includes.rb

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



43
44
45
# File 'lib/the_force/remote_includes.rb', line 43

def [](key)
  self.send(key.to_sym)
end

#keyObject



47
48
49
# File 'lib/the_force/remote_includes.rb', line 47

def key
  name
end

#last_cached_atObject



59
60
61
62
63
# File 'lib/the_force/remote_includes.rb', line 59

def last_cached_at
  return nil unless Rails.cache.instance_of? ActiveSupport::Cache::FileStore

  File.mtime(Rails.cache.instance_eval("real_file_path('#{self.key}')")) rescue nil
end

#recache!Object



55
56
57
# File 'lib/the_force/remote_includes.rb', line 55

def recache!
  RemoteIncludes.cache_url_with_partial_fallback(self.url, self.name, self.backup_partial)
end

#valueObject



51
52
53
# File 'lib/the_force/remote_includes.rb', line 51

def value
  Rails.cache.read(key)
end