Class: Rubyblok::Services::ReplaceStoryblokUrl
- Inherits:
-
Object
- Object
- Rubyblok::Services::ReplaceStoryblokUrl
- Defined in:
- lib/rubyblok/services/replace_storyblok_url.rb
Instance Attribute Summary collapse
-
#story ⇒ Object
readonly
Returns the value of attribute story.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(story:) ⇒ ReplaceStoryblokUrl
constructor
A new instance of ReplaceStoryblokUrl.
Constructor Details
#initialize(story:) ⇒ ReplaceStoryblokUrl
Returns a new instance of ReplaceStoryblokUrl.
12 13 14 |
# File 'lib/rubyblok/services/replace_storyblok_url.rb', line 12 def initialize(story:) @story = story end |
Instance Attribute Details
#story ⇒ Object (readonly)
Returns the value of attribute story.
6 7 8 |
# File 'lib/rubyblok/services/replace_storyblok_url.rb', line 6 def story @story end |
Class Method Details
.call(story:) ⇒ Object
8 9 10 |
# File 'lib/rubyblok/services/replace_storyblok_url.rb', line 8 def self.call(story:) new(story:).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rubyblok/services/replace_storyblok_url.rb', line 16 def call return story unless use_cdn_images? image_fields = find_image_fields(story['content']) image_fields.each do |image_field| replace_url(image_field) end story end |