module Caracal::Core::FileName
This module encapsulates all the functionality related to setting the document's name.
Public Class Methods
included(base)
click to toggle source
# File lib/caracal/core/file_name.rb, line 8 def self.included(base) base.class_eval do #------------------------------------------------------------- # Configuration #------------------------------------------------------------- # constants const_set(:DEFAULT_FILE_NAME, 'caracal.docx') # accessors attr_reader :name attr_reader :path #------------------------------------------------------------- # Public Methods #------------------------------------------------------------- # This method sets the name of the output file. Defaults # to the name of the library. # def file_name(value=nil) v = value.to_s.strip a = v.split('/') @name = (v == '') ? self.class::DEFAULT_FILE_NAME : a.last @path = (a.size > 1) ? v : "./#{ v }" end end end
Public Instance Methods
file_name(value=nil)
click to toggle source
This method sets the name of the output file. Defaults to the name of the library.
# File lib/caracal/core/file_name.rb, line 30 def file_name(value=nil) v = value.to_s.strip a = v.split('/') @name = (v == '') ? self.class::DEFAULT_FILE_NAME : a.last @path = (a.size > 1) ? v : "./#{ v }" end