Class: Fare::ConfigurationWhenLocked

Inherits:
Object
  • Object
show all
Defined in:
lib/fare/configuration_when_locked.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ConfigurationWhenLocked

Returns a new instance of ConfigurationWhenLocked.



6
7
8
9
10
11
# File 'lib/fare/configuration_when_locked.rb', line 6

def initialize(options)
  @options = options
  validate_lockfile!
  @configuration = loaded_configuration.load_configuration
  @configuration.load_environment(environment)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/fare/configuration_when_locked.rb', line 4

def options
  @options
end

Instance Method Details

#app_nameObject



24
25
26
# File 'lib/fare/configuration_when_locked.rb', line 24

def app_name
  configuration.app_name
end

#app_versionObject



28
29
30
# File 'lib/fare/configuration_when_locked.rb', line 28

def app_version
  configuration.app_version || "unknown"
end

#fetch_subscriber(name) ⇒ Object



32
33
34
# File 'lib/fare/configuration_when_locked.rb', line 32

def fetch_subscriber(name)
  configuration.subscribers.fetch(name)
end

#fetch_subscriber_queue(name) ⇒ Object



36
37
38
# File 'lib/fare/configuration_when_locked.rb', line 36

def fetch_subscriber_queue(name)
  Fare.queue_adapter.fetch(environment, name)
end

#find_publishable_topic(options) ⇒ Object



18
19
20
21
22
# File 'lib/fare/configuration_when_locked.rb', line 18

def find_publishable_topic(options)
  lock_file_contents.fetch("publishes").find { |t|
    t.fetch("subject") == options.fetch(:subject) && t.fetch("action") == options.fetch(:action)
  }
end

#validate_subscriber!Object



13
14
15
16
# File 'lib/fare/configuration_when_locked.rb', line 13

def validate_subscriber!
  configuration.setup.call
  configuration.stacks.each(&:to_app)
end