Class: CacheRocket::Fragment

Inherits:
Object
  • Object
show all
Includes:
Key
Defined in:
lib/cache_rocket/fragment.rb

Constant Summary

Constants included from Key

Key::CACHE_REPLACE_KEY_OPEN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Key

#cache_replace_key

Constructor Details

#initialize(value) ⇒ Fragment

Returns a new instance of Fragment.



7
8
9
# File 'lib/cache_rocket/fragment.rb', line 7

def initialize(value)
  self.value = value
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/cache_rocket/fragment.rb', line 5

def value
  @value
end

Instance Method Details

#gsub!(key, value) ⇒ Object



15
16
17
# File 'lib/cache_rocket/fragment.rb', line 15

def gsub!(key, value)
  self.value.gsub! key, value
end

#replace(hash, collection) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/cache_rocket/fragment.rb', line 19

def replace(hash, collection)
  if collection
    replace_collection collection, hash
  else
    replace_from_hash hash
  end
end

#to_sObject



11
12
13
# File 'lib/cache_rocket/fragment.rb', line 11

def to_s
  value
end