Class: Knowledge::Adapters::File

Inherits:
KeyValue show all
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

Method Summary

Methods inherited from KeyValue

#run

Methods inherited from Base

#initialize, #run

Constructor Details

This class inherits a constructor from Knowledge::Adapters::Base

Instance Attribute Details

#setterClass (readonly)

Returns the current value of setter.

Returns:

  • (Class)

    the current value of setter



30
31
32
# File 'lib/knowledge/adapters/file.rb', line 30

def setter
  @setter
end

#variablesHash (readonly)

Returns the current value of variables.

Returns:

  • (Hash)

    the current value of variables



30
31
32
# File 'lib/knowledge/adapters/file.rb', line 30

def variables
  @variables
end