summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/comment.rb
diff options
context:
space:
mode:
authorJurriaan Pruis <[email protected]>2014-01-15 23:44:02 +0100
committerJurriaan Pruis <[email protected]>2014-02-26 20:09:21 +0100
commitbe8e00332c73439cf17083173ea74f1505100df9 (patch)
tree383ec2e23fc0a14aa5ad90e139648a79814eeded /lib/axlsx/workbook/worksheet/comment.rb
parenta271a7d0f26ecb26d01aad00e094744d6fe8b0d2 (diff)
downloadcaxlsx-be8e00332c73439cf17083173ea74f1505100df9.tar.gz
caxlsx-be8e00332c73439cf17083173ea74f1505100df9.zip
Huge refactoring
Do not create huge strings Let Row inherit from SimpleTypedList Optimized sanitizing Optimized validation And more..
Diffstat (limited to 'lib/axlsx/workbook/worksheet/comment.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/comment.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb
index 7035f4cf..e5dbe41c 100644
--- a/lib/axlsx/workbook/worksheet/comment.rb
+++ b/lib/axlsx/workbook/worksheet/comment.rb
@@ -24,11 +24,10 @@ module Axlsx
string_attr_accessor :text, :author
boolean_attr_accessor :visible
- # The owning Comments object
+ # The owning Comments object
# @return [Comments]
attr_reader :comments
-
# The string based cell position reference (e.g. 'A1') that determines the positioning of this comment
# @return [String|Cell]
attr_reader :ref
@@ -53,7 +52,7 @@ module Axlsx
# @see ref
def ref=(v)
- Axlsx::DataTypeValidator.validate "Comment.ref", [String, Cell], v
+ Axlsx::DataTypeValidator.validate :comment_ref, [String, Cell], v
@ref = v if v.is_a?(String)
@ref = v.r if v.is_a?(Cell)
end
@@ -63,15 +62,15 @@ module Axlsx
# @return [String]
def to_xml_string(str = "")
author = @comments.authors[author_index]
- str << '<comment ref="' << ref << '" authorId="' << author_index.to_s << '">'
+ str << ('<comment ref="' << ref << '" authorId="' << author_index.to_s << '">')
str << '<text>'
unless author.to_s == ""
str << '<r><rPr><b/><color indexed="81"/></rPr>'
- str << "<t>" << ::CGI.escapeHTML(author.to_s) << ":\n</t></r>"
+ str << ("<t>" << ::CGI.escapeHTML(author.to_s) << ":\n</t></r>")
end
str << '<r>'
str << '<rPr><color indexed="81"/></rPr>'
- str << '<t>' << ::CGI.escapeHTML(text) << '</t></r></text>'
+ str << ('<t>' << ::CGI.escapeHTML(text) << '</t></r></text>')
str << '</comment>'
end