Class: CaptainConfig::ConfiguredEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/captain_config/configured_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, model) ⇒ ConfiguredEntry

Returns a new instance of ConfiguredEntry.



7
8
9
10
11
# File 'lib/captain_config/configured_entry.rb', line 7

def initialize(key, model)
  @key = key
  @model = model
  @default = nil
end

Instance Attribute Details

#defaultObject

Returns the value of attribute default.



5
6
7
# File 'lib/captain_config/configured_entry.rb', line 5

def default
  @default
end

#keyObject (readonly)

Returns the value of attribute key.



2
3
4
# File 'lib/captain_config/configured_entry.rb', line 2

def key
  @key
end

#modelObject (readonly)

Class of the model (eg. ‘CaptainConfig::BooleanConfig`).



4
5
6
# File 'lib/captain_config/configured_entry.rb', line 4

def model
  @model
end

Instance Method Details

#default_valueObject



13
14
15
16
17
18
19
# File 'lib/captain_config/configured_entry.rb', line 13

def default_value
  if default.respond_to?(:call)
    default.call
  else
    default
  end
end