Class: CacheRocket::Fragment
- Inherits:
-
Object
- Object
- CacheRocket::Fragment
- Includes:
- Key
- Defined in:
- lib/cache_rocket/fragment.rb
Instance Method Summary collapse
- #gsub!(key, value) ⇒ Object
-
#initialize(value) ⇒ Fragment
constructor
A new instance of Fragment.
- #replace(hash, collection) ⇒ Object
- #to_s ⇒ Object
Methods included from 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_s ⇒ Object
11 12 13 |
# File 'lib/cache_rocket/fragment.rb', line 11 def to_s @value end |