Module: Eco::API::UseCases::GraphQL::Helpers::Location::Command::Diffs::Stages

Defined in:
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/sortable.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/commandable.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/diff_sortable.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/diff_sortable/for_archive.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/diff_sortable/for_unarchive.rb,
lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages/sortable/relation_safe_sort.rb

Defined Under Namespace

Modules: Commandable, DiffSortable, Sortable

Constant Summary collapse

STAGES =
%i[unarchive id_name insert move archive].freeze

Instance Method Summary collapse

Instance Method Details

#after_id_update?(stage) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 70

def after_id_update?(stage)
  (idx = stage_idx(stage)) && idx > id_update_stage_idx
end

#during_or_after_move?(stage) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 74

def during_or_after_move?(stage)
  (idx = stage_idx(stage)) && idx >= move_stage_idx
end

#id_update_stage_idxObject



62
63
64
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 62

def id_update_stage_idx
  @id_update_stage_idx ||= stage_idx(:id) || stage_idx(:id_name)
end

#move_stage_idxObject



66
67
68
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 66

def move_stage_idx
  @move_stage_idx ||= stage_idx(:move)
end

#stage_idx(stage) ⇒ Object



58
59
60
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 58

def stage_idx(stage)
  stages.index(stage)
end

#stagesObject



54
55
56
# File 'lib/eco/api/usecases/graphql/helpers/location/command/diffs/stages.rb', line 54

def stages
  STAGES
end