summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/comment.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-13 11:09:12 +0900
committerRandy Morgan <[email protected]>2012-05-13 11:09:12 +0900
commit34f63d6719fd913be9251f367370947303f8fc61 (patch)
treeebe3531eaf04838533cb0dbf18c4ea1844b27925 /lib/axlsx/workbook/worksheet/comment.rb
parent88b67ba036c038be9d2cb116bb70eac720f3e40b (diff)
downloadcaxlsx-34f63d6719fd913be9251f367370947303f8fc61.tar.gz
caxlsx-34f63d6719fd913be9251f367370947303f8fc61.zip
cleaning up comments for pre-release
Diffstat (limited to 'lib/axlsx/workbook/worksheet/comment.rb')
-rw-r--r--lib/axlsx/workbook/worksheet/comment.rb26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/axlsx/workbook/worksheet/comment.rb b/lib/axlsx/workbook/worksheet/comment.rb
index 708b6ac4..f3d19e13 100644
--- a/lib/axlsx/workbook/worksheet/comment.rb
+++ b/lib/axlsx/workbook/worksheet/comment.rb
@@ -7,10 +7,10 @@ module Axlsx
# @return [String]
attr_reader :text
- # The index of the the author for this comment in the owning Comments object
+ # The author of this comment
# @see Comments
- # @return [Integer]
- attr_reader :author_index
+ # @return [String]
+ attr_reader :author
# The owning Comments object
# @return [Comments]
@@ -44,7 +44,15 @@ module Axlsx
# The index of this comment
# @return [Integer]
def index
- @comments.comment_list.index(self)
+ @comments.index(self)
+ end
+
+ #
+ # The index of this author in a unique sorted list of all authors in
+ # the comment.
+ # @return [Integer]
+ def author_index
+ @comments.authors.index(author)
end
# @see ref
@@ -60,10 +68,9 @@ module Axlsx
@text = v
end
- # @see author_index
- def author_index=(v)
- Axlsx::validate_unsigned_int(v)
- @author_index = v
+ # @see author
+ def author=(v)
+ @author = v
end
# serialize the object
@@ -87,9 +94,8 @@ module Axlsx
# initialize the vml shape based on this comment's ref/position in the worksheet.
# by default, all columns are 5 columns wide and 5 rows high
def initialize_vml_shape
- ws = self.comments.worksheet
pos = Axlsx::name_to_indices(ref)
- @vml_shape = VmlShape.new(self, :row => pos[1], :column => pos[0]) do |vml|
+ @vml_shape = VmlShape.new(:row => pos[1], :column => pos[0]) do |vml|
vml.left_column = vml.row + 1
vml.right_column = vml.column + 4
vml.top_row = vml.row