Class: CC::Config::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/config/engine.rb

Constant Summary collapse

DEFAULT_CHANNEL =
"stable".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, enabled: false, channel: nil, config: nil, exclude_patterns: []) ⇒ Engine

Returns a new instance of Engine.



10
11
12
13
14
15
16
# File 'lib/cc/config/engine.rb', line 10

def initialize(name, enabled: false, channel: nil, config: nil, exclude_patterns: [])
  @name = name
  @enabled = enabled
  @channel = channel || DEFAULT_CHANNEL
  @config = config || {}
  @exclude_patterns = exclude_patterns
end

Instance Attribute Details

#channelObject

Returns the value of attribute channel.



6
7
8
# File 'lib/cc/config/engine.rb', line 6

def channel
  @channel
end

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/cc/config/engine.rb', line 7

def config
  @config
end

#enabled=(value) ⇒ Object (writeonly)

Sets the attribute enabled

Parameters:

  • value

    the value to set the attribute enabled to.



8
9
10
# File 'lib/cc/config/engine.rb', line 8

def enabled=(value)
  @enabled = value
end

#exclude_patternsObject (readonly)

Returns the value of attribute exclude_patterns.



7
8
9
# File 'lib/cc/config/engine.rb', line 7

def exclude_patterns
  @exclude_patterns
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/cc/config/engine.rb', line 7

def name
  @name
end

Instance Method Details

#container_labelObject



26
27
28
# File 'lib/cc/config/engine.rb', line 26

def container_label
  @container_label ||= SecureRandom.uuid
end

#enabled?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/cc/config/engine.rb', line 18

def enabled?
  @enabled
end

#eql?(other) ⇒ Boolean Also known as: ==, equal?

Returns:

  • (Boolean)


34
35
36
# File 'lib/cc/config/engine.rb', line 34

def eql?(other)
  other.is_a?(self.class) && name.eql?(other.name)
end

#hashObject



30
31
32
# File 'lib/cc/config/engine.rb', line 30

def hash
  name.hash
end

#plugin?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/cc/config/engine.rb', line 22

def plugin?
  !DefaultAdapter::ENGINES.keys.include?(name)
end