Class: Dsu::Services::EntryGroup::EditorService

Inherits:
Object
  • Object
show all
Includes:
Dsu::Support::ColorThemable, Dsu::Support::TimeFormatable
Defined in:
lib/dsu/services/entry_group/editor_service.rb

Instance Method Summary collapse

Methods included from Dsu::Support::TimeFormatable

dd_mm_yyyy, formatted_time, mm_dd, mm_dd_yyyy, timezone_for, yyyy_mm_dd, yyyy_mm_dd_or_through_for

Methods included from Dsu::Support::ColorThemable

apply_theme, #prompt_with_options

Constructor Details

#initialize(entry_group:, options: {}) ⇒ EditorService

Returns a new instance of EditorService.

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
26
# File 'lib/dsu/services/entry_group/editor_service.rb', line 19

def initialize(entry_group:, options: {})
  raise ArgumentError, 'entry_group is nil' if entry_group.nil?
  raise ArgumentError, 'entry_group is the wrong object type' unless entry_group.is_a?(Models::EntryGroup)
  raise ArgumentError, 'options is the wrong object type' unless options.is_a?(Hash) || options.nil?

  @entry_group = entry_group
  @options = options || {}
end

Instance Method Details

#callObject



28
29
30
31
32
33
34
# File 'lib/dsu/services/entry_group/editor_service.rb', line 28

def call
  edit_view = render_edit_view
  edit edit_view
  # NOTE: Return the original entry group object as any permanent changes
  # will have been applied to it.
  entry_group
end