Class: Knowledge::Adapters::File
- Defined in:
- lib/knowledge/adapters/file.rb
Overview
Description
This adapter takes some vars in a config file and put it in your project’s config. The config file should provide some YAML with key=value format.
It works exactly like the KeyValue adapter, just pass a path to the learner as variables descriptor.
Usage
@example:
# Define your vars with the name of the variable as key and the value as value
my_vars = { application_token: 's3cret', aws_secret: 's3cret' }
# Initializes the adapter
adapter = Knowledge::Adapters::File.new(setter: MySetter, variables: my_vars)
# And run it
adapter.run
Attributes
Instance Attribute Summary collapse
-
#setter ⇒ Class
readonly
The current value of setter.
-
#variables ⇒ Hash
readonly
The current value of variables.
Method Summary
Methods inherited from KeyValue
Methods inherited from Base
Constructor Details
This class inherits a constructor from Knowledge::Adapters::Base
Instance Attribute Details
#setter ⇒ Class (readonly)
Returns the current value of setter.
30 31 32 |
# File 'lib/knowledge/adapters/file.rb', line 30 def setter @setter end |
#variables ⇒ Hash (readonly)
Returns the current value of variables.
30 31 32 |
# File 'lib/knowledge/adapters/file.rb', line 30 def variables @variables end |