Class: ClockworkComicPDF::Cover

Inherits:
Object
  • Object
show all
Includes:
OptionValidation
Defined in:
lib/clockwork_comic_pdf/cover.rb

Overview

this contains the size, file path, and size of the cover

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionValidation

#check_options, #check_required

Constructor Details

#initialize(options = {}) ⇒ Cover

Returns a new instance of Cover.



35
36
37
38
39
40
# File 'lib/clockwork_comic_pdf/cover.rb', line 35

def initialize(options = {})
  check_options(options.keys, [:size, :path, :file])
  self.path = options[:path]
  self.size = options[:size]
  self.file = options[:file]
end

Instance Attribute Details

#fileObject

Returns the value of attribute file.



24
25
26
# File 'lib/clockwork_comic_pdf/cover.rb', line 24

def file
  @file
end

#pathObject

Returns the value of attribute path.



19
20
21
# File 'lib/clockwork_comic_pdf/cover.rb', line 19

def path
  @path
end

#sizeObject

Returns the value of attribute size.



9
10
11
# File 'lib/clockwork_comic_pdf/cover.rb', line 9

def size
  @size
end

Instance Method Details

#validateObject



29
30
31
32
33
# File 'lib/clockwork_comic_pdf/cover.rb', line 29

def validate
  fail InvalidValueError, 'Cover Must specify a file' unless file
  fail InvalidValueError, 'Cover must specify a size' unless size
  fail InvalidValueError, 'Cover must specify a path' unless path
end