Class: Ribose::CLI::RCFile
- Inherits:
-
Object
- Object
- Ribose::CLI::RCFile
- Defined in:
- lib/ribose/cli/rcfile.rb
Constant Summary collapse
- FILE_NAME =
".riboserc".freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ RCFile
constructor
A new instance of RCFile.
- #set(token:, email:) ⇒ Object
Constructor Details
#initialize ⇒ RCFile
Returns a new instance of RCFile.
10 11 12 13 |
# File 'lib/ribose/cli/rcfile.rb', line 10 def initialize @path = build_rcfile_path @data = load_configuration end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/ribose/cli/rcfile.rb', line 7 def data @data end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/ribose/cli/rcfile.rb', line 7 def path @path end |
Class Method Details
.api_token ⇒ Object
22 23 24 |
# File 'lib/ribose/cli/rcfile.rb', line 22 def self.api_token new.data[:api_token] end |
.set(token:, email:) ⇒ Object
30 31 32 |
# File 'lib/ribose/cli/rcfile.rb', line 30 def self.set(token:, email:) new.set(token: token, email: email) end |
.user_email ⇒ Object
26 27 28 |
# File 'lib/ribose/cli/rcfile.rb', line 26 def self.user_email new.data[:user_email] end |
Instance Method Details
#set(token:, email:) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ribose/cli/rcfile.rb', line 15 def set(token:, email:) data[:api_token] = token data[:user_email] = email write_api_details_to_file end |