Class: ReVIEW::Book::Parameters
Instance Attribute Summary collapse
-
#ext ⇒ Object
readonly
Returns the value of attribute ext.
-
#image_types ⇒ Object
readonly
Returns the value of attribute image_types.
-
#page_metric ⇒ Object
readonly
Returns the value of attribute page_metric.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Parameters
constructor
A new instance of Parameters.
Constructor Details
#initialize(params = {}) ⇒ Parameters
Returns a new instance of Parameters.
57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/review/book/parameters.rb', line 57 def initialize(params = {}) @chapter_file = params[:chapter_file] || 'CHAPS' @part_file = params[:part_file] || 'PART' @reject_file = params[:reject_file] || 'REJECT' @predef_file = params[:predef_file] || 'PREDEF' @postdef_file = params[:postdef_file] || 'POSTDEF' @page_metric = params[:page_metric] || PageMetric.a5 @ext = params[:ext] || '.re' @image_dir = params[:image_dir] || 'images' @image_types = unify_exts(params[:image_types] || %w( eps ai tif tiff png bmp jpg jpeg gif svg pdf )) @bib_file = params[:bib_file] || "bib#{@ext}" end |
Instance Attribute Details
#ext ⇒ Object (readonly)
Returns the value of attribute ext.
90 91 92 |
# File 'lib/review/book/parameters.rb', line 90 def ext @ext end |
#image_types ⇒ Object (readonly)
Returns the value of attribute image_types.
92 93 94 |
# File 'lib/review/book/parameters.rb', line 92 def image_types @image_types end |
#page_metric ⇒ Object (readonly)
Returns the value of attribute page_metric.
93 94 95 |
# File 'lib/review/book/parameters.rb', line 93 def page_metric @page_metric end |
Class Method Details
.default ⇒ Object
16 17 18 |
# File 'lib/review/book/parameters.rb', line 16 def Parameters.default new() end |
.get_page_metric(mod) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/review/book/parameters.rb', line 38 def Parameters.get_page_metric(mod) if paper = const_get_safe(mod, :PAPER) unless PageMetric.respond_to?(paper.downcase) raise ConfigError, "unknown paper size: #{paper}" end return PageMetric.send(paper.downcase) end PageMetric.new(const_get_safe(mod, :LINES_PER_PAGE_list) || 46, const_get_safe(mod, :COLUMNS_list) || 80, const_get_safe(mod, :LINES_PER_PAGE_text) || 30, const_get_safe(mod, :COLUMNS_text) || 74) # 37zw end |
.load(path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/review/book/parameters.rb', line 20 def Parameters.load(path) mod = Module.new mod.module_eval File.read(path), path new( :chapter_file => const_get_safe(mod, :CHAPS_FILE), :part_file => const_get_safe(mod, :PART_FILE), :bib_file => const_get_safe(mod, :BIB_FILE), :reject_file => const_get_safe(mod, :REJECT_FILE) || const_get_safe(mod, :WORDS_FILE), :predef_file => const_get_safe(mod, :PREDEF_FILE), :postdef_file => const_get_safe(mod, :POSTDEF_FILE), :ext => const_get_safe(mod, :EXT), :image_dir => const_get_safe(mod, :IMAGE_DIR), :image_types => const_get_safe(mod, :IMAGE_TYPES), :page_metric => get_page_metric(mod) ) end |
.path_param(name) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/review/book/parameters.rb', line 76 def self.path_param(name) module_eval(<<-End, __FILE__, __LINE__ + 1) def #{name} "\#{@basedir}/\#{@#{name}}" end End end |