Class: RubyEdit::Commands::Configure

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_edit/commands/configure.rb

Constant Summary collapse

CONFIGURATIONS =
%i[editor grep_options].freeze

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Configure

Returns a new instance of Configure.



10
11
12
# File 'lib/ruby_edit/commands/configure.rb', line 10

def initialize(options)
  @options = options
end

Instance Method Details

#execute(output: $stdout) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/ruby_edit/commands/configure.rb', line 14

def execute(output: $stdout)
  options.each do |key, val|
    if val == key.to_s
      output.puts RubyEdit.config.send(key)
    else
      RubyEdit.config.send("#{key}=", val)
      output.puts "#{key.to_s.titleize} changed to #{val}"
    end
  end
end