Class: Spotlight::CloneTranslatedPageFromLocale
- Inherits:
-
Object
- Object
- Spotlight::CloneTranslatedPageFromLocale
- Defined in:
- app/services/spotlight/clone_translated_page_from_locale.rb
Overview
A service class to encapsulate business logic around cloning and destroying translated pages
Instance Attribute Summary collapse
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Class Method Summary collapse
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(locale:, page:) ⇒ CloneTranslatedPageFromLocale
constructor
A new instance of CloneTranslatedPageFromLocale.
Constructor Details
#initialize(locale:, page:) ⇒ CloneTranslatedPageFromLocale
Returns a new instance of CloneTranslatedPageFromLocale.
10 11 12 13 |
# File 'app/services/spotlight/clone_translated_page_from_locale.rb', line 10 def initialize(locale:, page:) @locale = locale @page = page end |
Instance Attribute Details
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
8 9 10 |
# File 'app/services/spotlight/clone_translated_page_from_locale.rb', line 8 def locale @locale end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'app/services/spotlight/clone_translated_page_from_locale.rb', line 8 def page @page end |
Class Method Details
.call(locale:, page:) ⇒ Object
15 16 17 |
# File 'app/services/spotlight/clone_translated_page_from_locale.rb', line 15 def self.call(locale:, page:) new(locale: locale, page: page).clone end |
Instance Method Details
#clone ⇒ Object
19 20 21 22 |
# File 'app/services/spotlight/clone_translated_page_from_locale.rb', line 19 def clone destroy page.clone_for_locale(locale) end |