Class: CacheRocket::Fragment

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

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)
  @value = value.to_s.dup
end

Instance Method Details

#gsub!(key, value) ⇒ Object



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

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

#replace(hash, collection) ⇒ Object



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

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

#to_sObject



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

def to_s
  @value
end