Class: Hoss::Config::Options::Option Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hoss/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/hoss/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

#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/hoss/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/hoss/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/hoss/config/options.rb', line 41

def type
  @type
end

#valueObject (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/hoss/config/options.rb', line 41

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.



47
48
49
# File 'lib/hoss/config/options.rb', line 47

def env_key
  "HOSS_#{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.



43
44
45
# File 'lib/hoss/config/options.rb', line 43

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