class RubyEdit::Commands::Configure

Constants

CONFIGURATIONS

Public Class Methods

new(options) click to toggle source
# File lib/ruby_edit/commands/configure.rb, line 10
def initialize(options)
  @options = options
end

Public Instance Methods

execute(output: $stdout) click to toggle source
# 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

Private Instance Methods

options() click to toggle source
# File lib/ruby_edit/commands/configure.rb, line 27
def options
  @options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }
end