Class: Crossfader::RCFile
- Inherits:
-
Object
- Object
- Crossfader::RCFile
- Includes:
- Singleton
- Defined in:
- lib/crossfader/rcfile.rb
Constant Summary collapse
- FILE_NAME =
'.crossfader'
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #[]=(email, profile) ⇒ Object
- #api_access_token ⇒ Object
- #configuration ⇒ Object
-
#initialize ⇒ RCFile
constructor
A new instance of RCFile.
- #load_file ⇒ Object
Constructor Details
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/crossfader/rcfile.rb', line 6 def path @path end |
Instance Method Details
#[]=(email, profile) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/crossfader/rcfile.rb', line 21 def []=(email, profile) configuration['email'] = profile[:email] configuration['api_access_token'] = profile[:api_access_token] configuration['dj_name'] = profile[:dj_name] write end |
#api_access_token ⇒ Object
32 33 34 |
# File 'lib/crossfader/rcfile.rb', line 32 def api_access_token @data['configuration']['api_access_token'] end |
#configuration ⇒ Object
28 29 30 |
# File 'lib/crossfader/rcfile.rb', line 28 def configuration @data['configuration'] end |
#load_file ⇒ Object
14 15 16 17 18 19 |
# File 'lib/crossfader/rcfile.rb', line 14 def load_file require 'yaml' YAML.load_file(@path) rescue Errno::ENOENT default_structure end |