Class: Announce::Adapters::BaseAdapter::Destination

Inherits:
Object
  • Object
show all
Defined in:
lib/announce/adapters/base_adapter.rb

Direct Known Subclasses

Queue, Topic

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, action, options = {}) ⇒ Destination

Returns a new instance of Destination.



77
78
79
80
81
# File 'lib/announce/adapters/base_adapter.rb', line 77

def initialize(subject, action, options = {})
  @subject = subject
  @action = action
  @options = options || {}
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



59
60
61
# File 'lib/announce/adapters/base_adapter.rb', line 59

def action
  @action
end

#optionsObject

Returns the value of attribute options.



59
60
61
# File 'lib/announce/adapters/base_adapter.rb', line 59

def options
  @options
end

#subjectObject

Returns the value of attribute subject.



59
60
61
# File 'lib/announce/adapters/base_adapter.rb', line 59

def subject
  @subject
end

Class Method Details

.appObject



95
96
97
# File 'lib/announce/adapters/base_adapter.rb', line 95

def self.app
  ::Announce.options[:app_name]
end

.delimiterObject



91
92
93
# File 'lib/announce/adapters/base_adapter.rb', line 91

def self.delimiter
  ::Announce.options[:queue_name_delimiter]
end

.name_for(subject, action) ⇒ Object



73
74
75
# File 'lib/announce/adapters/base_adapter.rb', line 73

def self.name_for(subject, action)
  [prefix, namespace, subject, action].join(delimiter)
end

.namespaceObject



99
100
101
# File 'lib/announce/adapters/base_adapter.rb', line 99

def self.namespace
  ::Announce.options[:namespace]
end

.prefixObject



87
88
89
# File 'lib/announce/adapters/base_adapter.rb', line 87

def self.prefix
  ::Announce.options[:queue_name_prefix]
end

Instance Method Details

#createObject

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/announce/adapters/base_adapter.rb', line 65

def create
  raise NotImplementedError.new("You must implement create.")
end

#name(subject = @subject, action = @action) ⇒ Object



83
84
85
# File 'lib/announce/adapters/base_adapter.rb', line 83

def name(subject = @subject, action = @action)
  self.class.name_for(subject, action)
end

#publish(message, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


61
62
63
# File 'lib/announce/adapters/base_adapter.rb', line 61

def publish(message, options = {})
  raise NotImplementedError.new("You must implement publish.")
end

#verifyObject

Raises:

  • (NotImplementedError)


69
70
71
# File 'lib/announce/adapters/base_adapter.rb', line 69

def verify
  raise NotImplementedError.new("You must implement verify.")
end