Class: Gotta::Mod::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/gotta/mod/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, absolute_path:, working_directory:) ⇒ Event

Returns a new instance of Event.



12
13
14
15
16
17
18
19
# 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

Instance Attribute Details

#absolute_pathObject (readonly)

Returns the value of attribute absolute_path.



6
7
8
# File 'lib/gotta/mod/event.rb', line 6

def absolute_path
  @absolute_path
end

#filenameObject (readonly)

Returns the value of attribute filename.



6
7
8
# File 'lib/gotta/mod/event.rb', line 6

def filename
  @filename
end

#pathObject (readonly)

Returns the value of attribute path.



6
7
8
# File 'lib/gotta/mod/event.rb', line 6

def path
  @path
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/gotta/mod/event.rb', line 6

def type
  @type
end

#working_directoryObject (readonly)

Returns the value of attribute working_directory.



6
7
8
# File 'lib/gotta/mod/event.rb', line 6

def working_directory
  @working_directory
end

Instance Method Details

#added?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/gotta/mod/event.rb', line 21

def added?
  @type == :added
end

#modified?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/gotta/mod/event.rb', line 25

def modified?
  @type == :modified
end

#removed?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/gotta/mod/event.rb', line 29

def removed?
  @type == :removed
end