Class: Messagebus::Swarm::Controller::ConfigurationSource

Inherits:
Struct
  • Object
show all
Defined in:
lib/messagebus/swarm/controller.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configuration_typeObject

Returns the value of attribute configuration_type

Returns:

  • (Object)

    the current value of configuration_type



41
42
43
# File 'lib/messagebus/swarm/controller.rb', line 41

def configuration_type
  @configuration_type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



41
42
43
# File 'lib/messagebus/swarm/controller.rb', line 41

def value
  @value
end

Instance Method Details

#configuration_hashObject



42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/messagebus/swarm/controller.rb', line 42

def configuration_hash
  case configuration_type
  when :path
    YAML.load_file(value)
  when :eval
    eval(value)
  when :default
    Messagebus::Swarm.default_configuration
  else
    raise "Unsupported configuration type #{configuration_type}"
  end
end