Class: RubyEdit::Configuration
- Inherits:
-
Object
- Object
- RubyEdit::Configuration
- Defined in:
- lib/ruby_edit/configuration.rb
Instance Method Summary collapse
- #editor ⇒ Object
- #editor=(editor) ⇒ Object
- #grep_options ⇒ Object
- #grep_options=(grep_options) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset_defaults ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
7 8 9 10 |
# File 'lib/ruby_edit/configuration.rb', line 7 def initialize @config = TTY::Config.new @config.read("#{RubyEdit::CONFIGURATION_LOCATION}.yml") end |
Instance Method Details
#editor ⇒ Object
12 13 14 |
# File 'lib/ruby_edit/configuration.rb', line 12 def editor @config.fetch(:editor) || 'vim' end |
#editor=(editor) ⇒ Object
16 17 18 19 |
# File 'lib/ruby_edit/configuration.rb', line 16 def editor=(editor) @config.set(:editor, value: editor) write end |
#grep_options ⇒ Object
21 22 23 |
# File 'lib/ruby_edit/configuration.rb', line 21 def @config.fetch(:grep_options) || 'ir' end |
#grep_options=(grep_options) ⇒ Object
25 26 27 28 |
# File 'lib/ruby_edit/configuration.rb', line 25 def () @config.set(:grep_options, value: ) write end |
#reset_defaults ⇒ Object
30 31 32 33 34 |
# File 'lib/ruby_edit/configuration.rb', line 30 def reset_defaults @config.set(:editor, value: 'vim') @config.set(:grep_options, value: 'ir') write end |