class Gotta::Mod::Event

Attributes

absolute_path[R]
filename[R]
path[R]
type[R]
working_directory[R]

Public Class Methods

new(type:, absolute_path:, working_directory:) click to toggle source
# File lib/gotta/mod/event.rb, line 12
def initialize(type:, absolute_path:, working_directory:)
  @working_directory = working_directory
  @absolute_path = absolute_path
  @path = relative_path_for(@absolute_path.dup)
  @filename = File.basename(@absolute_path)
  @type = type
  make_it_immutable
end

Public Instance Methods

added?() click to toggle source
# File lib/gotta/mod/event.rb, line 21
def added?
  @type == :added
end
modified?() click to toggle source
# File lib/gotta/mod/event.rb, line 25
def modified?
  @type == :modified
end
removed?() click to toggle source
# File lib/gotta/mod/event.rb, line 29
def removed?
  @type == :removed
end

Private Instance Methods

make_it_immutable() click to toggle source
# File lib/gotta/mod/event.rb, line 39
def make_it_immutable
  freeze
end
relative_path_for(pth) click to toggle source
# File lib/gotta/mod/event.rb, line 34
def relative_path_for(pth)
  pth.slice!("#{working_directory}/")
  pth
end