Class: ClockworkComicPDF::Section

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

Overview

this is the base class for sections data that stores common section info

Direct Known Subclasses

SectionComicPages, SectionTextBox

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionValidation

#check_options, #check_required

Constructor Details

#initialize(options = {}) ⇒ Section

Returns a new instance of Section.



89
90
91
92
93
# File 'lib/clockwork_comic_pdf/section.rb', line 89

def initialize(options = {})
  self.name = options[:name]
  self.type = options[:type]
  self.print_section_intro = options[:print_section_intro]
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



75
76
77
# File 'lib/clockwork_comic_pdf/section.rb', line 75

def name
  @name
end


69
70
71
72
# File 'lib/clockwork_comic_pdf/section.rb', line 69

def print_section_intro
  @print_section_intro = false if @print_section_intro.nil?
  @print_section_intro
end

#typeObject

Returns the value of attribute type.



74
75
76
# File 'lib/clockwork_comic_pdf/section.rb', line 74

def type
  @type
end

Instance Method Details

#req_keysObject



81
82
83
# File 'lib/clockwork_comic_pdf/section.rb', line 81

def req_keys
  @required_keys = { name: @name }
end

#valid_optionsObject



77
78
79
# File 'lib/clockwork_comic_pdf/section.rb', line 77

def valid_options
  @valid_options = [:print_section_intro, :type, :name]
end

#validateObject



85
86
87
# File 'lib/clockwork_comic_pdf/section.rb', line 85

def validate
  check_required(req_keys)
end