Class: Sod::Prefabs::Actions::Config::Edit

Inherits:
Action
  • Object
show all
Defined in:
lib/sod/prefabs/actions/config/edit.rb

Overview

Edits project configuration.

Instance Attribute Summary

Attributes inherited from Action

#record

Instance Method Summary collapse

Methods inherited from Action

ancillary, default, description, inherited, #inspect, on, #to_proc

Constructor Details

#initialize(path = nil) ⇒ Edit

:reek:ControlParameter



20
21
22
23
# File 'lib/sod/prefabs/actions/config/edit.rb', line 20

def initialize(path = nil, **)
  super(**)
  @path = Pathname(path || context.xdg_config.active)
end

Instance Method Details

#callObject



25
26
27
28
29
30
# File 'lib/sod/prefabs/actions/config/edit.rb', line 25

def call(*)
  return unless check

  logger.info { "Editing: #{path.to_s.inspect}." }
  kernel.system "$EDITOR #{path}"
end