Class: Fancyhands::Configuration
- Inherits:
-
Object
- Object
- Fancyhands::Configuration
- Defined in:
- lib/fancyhands/configuration.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/fancyhands/configuration.rb', line 5 def key @key end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
5 6 7 |
# File 'lib/fancyhands/configuration.rb', line 5 def secret @secret end |
Class Method Details
.config_file ⇒ Object
24 25 26 |
# File 'lib/fancyhands/configuration.rb', line 24 def self.config_file YAML.load(file) end |
.file ⇒ Object
28 29 30 |
# File 'lib/fancyhands/configuration.rb', line 28 def self.file @file ||= File.read('./config/fancyhands.yml') end |
.from_config ⇒ Object
17 18 19 20 21 22 |
# File 'lib/fancyhands/configuration.rb', line 17 def self.from_config config = Configuration.new config.set_key(config_file['key']) config.set_secret(config_file['secret']) config end |
Instance Method Details
#set_key(key) ⇒ Object
7 8 9 10 |
# File 'lib/fancyhands/configuration.rb', line 7 def set_key(key) key ||= ENV['FANCYHANDS_KEY'] @key = key end |
#set_secret(secret) ⇒ Object
12 13 14 15 |
# File 'lib/fancyhands/configuration.rb', line 12 def set_secret(secret) secret ||= ENV['FANCYHANDS_SECRET'] @secret = secret end |