Class: Settingify::DbReader
- Inherits:
-
Struct
- Object
- Struct
- Settingify::DbReader
- Defined in:
- lib/settingify/db_reader.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#key ⇒ Object
Returns the value of attribute key.
Instance Method Summary collapse
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default
2 3 4 |
# File 'lib/settingify/db_reader.rb', line 2 def default @default end |
#key ⇒ Object
Returns the value of attribute key
2 3 4 |
# File 'lib/settingify/db_reader.rb', line 2 def key @key end |
Instance Method Details
#call ⇒ Object
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 |