forked from urvin-compliance/caracal
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow paths in file names; added save method to document instances; f…
…ixed issue with empty paragraphs following tables when they actually needed to be inserted in table cells sometimes.
- Loading branch information
Showing
6 changed files
with
57 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
module Caracal | ||
module Core | ||
# This module encapsulates all the functionality related to setting the | ||
|
||
# This module encapsulates all the functionality related to setting the | ||
# document's name. | ||
# | ||
module FileName | ||
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 | ||
@name = (v == '') ? self.class::DEFAULT_FILE_NAME : v | ||
a = v.split('/') | ||
|
||
@name = (v == '') ? self.class::DEFAULT_FILE_NAME : a.last | ||
@path = (a.size > 1) ? v : "./#{ v }" | ||
end | ||
|
||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Caracal | ||
VERSION = '1.3.0' | ||
VERSION = '1.4.0' | ||
end |