Class: CommandTower::Messaging::Accept::ExcludedDestination

Inherits:
Data
  • Object
show all
Defined in:
app/services/command_tower/messaging/accept/excluded_destination.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



6
7
8
# File 'app/services/command_tower/messaging/accept/excluded_destination.rb', line 6

def destination
  @destination
end

#reason_classObject (readonly)

Returns the value of attribute reason_class

Returns:

  • (Object)

    the current value of reason_class



6
7
8
# File 'app/services/command_tower/messaging/accept/excluded_destination.rb', line 6

def reason_class
  @reason_class
end

Class Method Details

.build(destination:, reason_class:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'app/services/command_tower/messaging/accept/excluded_destination.rb', line 7

def self.build(destination:, reason_class:)
  dest =
    if destination == :inbox || destination.to_s == "inbox"
      :inbox
    else
      destination.to_s
    end

  new(destination: dest, reason_class: reason_class.to_s).freeze
end

Instance Method Details

#sort_keyObject



18
19
20
# File 'app/services/command_tower/messaging/accept/excluded_destination.rb', line 18

def sort_key
  destination == :inbox ? "inbox" : destination.to_s
end