Class: ClockworkComicPDF::Version
- Inherits:
-
Object
- Object
- ClockworkComicPDF::Version
- Includes:
- OptionValidation
- Defined in:
- lib/clockwork_comic_pdf/version.rb
Overview
stores version information for PDF generation includes name, length, dpi and a toggle for printing the cover
Instance Attribute Summary collapse
-
#dpi ⇒ Object
Returns the value of attribute dpi.
-
#name ⇒ Object
Returns the value of attribute name.
- #print_cover ⇒ Object
- #trim_offset ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Version
constructor
A new instance of Version.
- #validate ⇒ Object
Methods included from OptionValidation
#check_options, #check_required
Constructor Details
#initialize(options = {}) ⇒ Version
Returns a new instance of Version.
51 52 53 54 55 56 57 |
# File 'lib/clockwork_comic_pdf/version.rb', line 51 def initialize( = {}) (.keys, [:name, :dpi, :print_cover, :trim_offset]) self.name = [:name] self.dpi = [:dpi] self.trim_offset = [:trim_offset] self.print_cover = [:print_cover] end |
Instance Attribute Details
#dpi ⇒ Object
Returns the value of attribute dpi.
26 27 28 |
# File 'lib/clockwork_comic_pdf/version.rb', line 26 def dpi @dpi end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/clockwork_comic_pdf/version.rb', line 21 def name @name end |
#print_cover ⇒ Object
31 32 33 34 |
# File 'lib/clockwork_comic_pdf/version.rb', line 31 def print_cover @print_cover = false if @print_cover.nil? @print_cover end |
#trim_offset ⇒ Object
37 38 39 40 |
# File 'lib/clockwork_comic_pdf/version.rb', line 37 def trim_offset @trim_offset = false if @trim_offset.nil? @trim_offset end |
Instance Method Details
#validate ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/clockwork_comic_pdf/version.rb', line 43 def validate fail InvalidValueError, 'Each version must contain a name' unless name fail InvalidValueError, 'Each version must contain a name' if name.length == 0 fail InvalidValueError, 'each version must specify a dpi value' unless dpi end |