Module: Card::View::Cache::Stub

Included in:
Card::View::Cache
Defined in:
lib/card/view/cache/stub.rb

Overview

A "stub" is a placeholder for a card view.

Cached views use stubs so that nesting content can remained cached even while nested content changes. The nested content's place is held by a stub.

A stub must contain all the information necessary to produce the view as intended.

Class Method Summary collapse

Class Method Details

.escape(stub_json) ⇒ Object



13
14
15
# File 'lib/card/view/cache/stub.rb', line 13

def escape stub_json
  stub_json.gsub "(", "_OParEN_"
end

.unescape(stub_json) ⇒ Object



17
18
19
# File 'lib/card/view/cache/stub.rb', line 17

def unescape stub_json
  stub_json.gsub "_OParEN_", "("
end