Class: Atatus::Config::Options::Option Private

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/config/options.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, value: nil, type: :string, default: nil, converter: nil) ⇒ Option

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Option.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/atatus/config/options.rb', line 26

def initialize(
  key,
  value: nil,
  type: :string,
  default: nil,
  converter: nil
)
  @key = key
  @type = type
  @default = default
  @converter = converter

  set(value || default)
end

Instance Attribute Details

#converterObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/atatus/config/options.rb', line 41

def converter
  @converter
end

#defaultObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/atatus/config/options.rb', line 41

def default
  @default
end

#keyObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/atatus/config/options.rb', line 41

def key
  @key
end

#typeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



41
42
43
# File 'lib/atatus/config/options.rb', line 41

def type
  @type
end

#valueObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/atatus/config/options.rb', line 42

def value
  @value
end

Instance Method Details

#env_keyObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'lib/atatus/config/options.rb', line 48

def env_key
  "ATATUS_#{key.upcase}"
end

#set(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/atatus/config/options.rb', line 44

def set(value)
  @value = normalize(value)
end