Class: ImageDiff::Snapshot

Inherits:
Object
  • Object
show all
Includes:
Differ, Writer
Defined in:
lib/image_diff/snapshot.rb

Overview

Snapshot class

Direct Known Subclasses

PNGSnapshot

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Differ

#reference_file

Methods included from Writer

#path_and_filename, #write

Constructor Details

#initialize(snapshot_path, file) ⇒ Snapshot

Returns a new instance of Snapshot.



18
19
20
21
# File 'lib/image_diff/snapshot.rb', line 18

def initialize(snapshot_path, file)
  @snapshot_path = snapshot_path
  @file = file
end

Class Attribute Details

.idObject (readonly)

Returns the value of attribute id.



13
14
15
# File 'lib/image_diff/snapshot.rb', line 13

def id
  @id
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



16
17
18
# File 'lib/image_diff/snapshot.rb', line 16

def file
  @file
end

#snapshot_pathObject (readonly)

Returns the value of attribute snapshot_path.



16
17
18
# File 'lib/image_diff/snapshot.rb', line 16

def snapshot_path
  @snapshot_path
end

Instance Method Details

#filenameObject



31
32
33
# File 'lib/image_diff/snapshot.rb', line 31

def filename
  "#{@file}#{extension}"
end

#filepathObject



27
28
29
# File 'lib/image_diff/snapshot.rb', line 27

def filepath
  File.join(fullpath, @file)
end

#fullpathObject



23
24
25
# File 'lib/image_diff/snapshot.rb', line 23

def fullpath
  FileUtils.mkdir_p(snapshot_path)
end