Class: Xray::Config
- Inherits:
-
Object
- Object
- Xray::Config
- Defined in:
- lib/xray/config.rb
Constant Summary collapse
- CONFIG_FILE =
".xrayconfig"
Instance Method Summary collapse
- #config_file ⇒ Object
- #default_editor ⇒ Object
- #editor ⇒ Object
- #editor=(new_editor) ⇒ Object
- #to_yaml ⇒ Object
Instance Method Details
#config_file ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/xray/config.rb', line 34 def config_file if File.exist?("#{Dir.pwd}/#{CONFIG_FILE}") "#{Dir.pwd}/#{CONFIG_FILE}" else "#{Dir.home}/#{CONFIG_FILE}" end end |
#default_editor ⇒ Object
10 11 12 13 14 15 |
# File 'lib/xray/config.rb', line 10 def default_editor ENV['GEM_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR'] || '/usr/local/bin/subl' end |
#editor ⇒ Object
17 18 19 |
# File 'lib/xray/config.rb', line 17 def editor load_config[:editor] end |
#editor=(new_editor) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/xray/config.rb', line 21 def editor=(new_editor) if new_editor && new_editor != editor write_config(editor: new_editor) true else false end end |
#to_yaml ⇒ Object
30 31 32 |
# File 'lib/xray/config.rb', line 30 def to_yaml {editor: editor}.to_yaml end |