Class: Settings
- Inherits:
-
Object
- Object
- Settings
- Defined in:
- lib/command/settings.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Instance Method Summary collapse
- #directory ⇒ Object
- #file ⇒ Object
- #home_directory ⇒ Object
-
#initialize ⇒ Settings
constructor
A new instance of Settings.
- #parse_settings ⇒ Object
- #running_on_windows? ⇒ Boolean
Constructor Details
#initialize ⇒ Settings
Returns a new instance of Settings.
4 5 6 |
# File 'lib/command/settings.rb', line 4 def initialize @key, @secret, @host = parse_settings end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
2 3 4 |
# File 'lib/command/settings.rb', line 2 def host @host end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
2 3 4 |
# File 'lib/command/settings.rb', line 2 def key @key end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
2 3 4 |
# File 'lib/command/settings.rb', line 2 def secret @secret end |
Instance Method Details
#directory ⇒ Object
8 9 10 |
# File 'lib/command/settings.rb', line 8 def directory File.join home_directory, 'MyFDB_Uploads' end |
#file ⇒ Object
12 13 14 |
# File 'lib/command/settings.rb', line 12 def file "#{ENV['HOME']}/.myfdb" end |
#home_directory ⇒ Object
20 21 22 |
# File 'lib/command/settings.rb', line 20 def home_directory running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME'] end |
#parse_settings ⇒ Object
16 17 18 |
# File 'lib/command/settings.rb', line 16 def parse_settings File.read(file).split('|') end |
#running_on_windows? ⇒ Boolean
24 25 26 |
# File 'lib/command/settings.rb', line 24 def running_on_windows? RUBY_PLATFORM =~ /mswin32|mingw32/ end |