Class: Settingify::DbReader

Inherits:
Struct
  • Object
show all
Defined in:
lib/settingify/db_reader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject

Returns the value of attribute default



2
3
4
# File 'lib/settingify/db_reader.rb', line 2

def default
  @default
end

#keyObject

Returns the value of attribute key



2
3
4
# File 'lib/settingify/db_reader.rb', line 2

def key
  @key
end

Instance Method Details

#callObject



3
4
5
6
7
# File 'lib/settingify/db_reader.rb', line 3

def call
  ::Settingify::Setting
    .where(key: key)
    .first_or_initialize(value: default)
end