Skip to content

Commit

Permalink
Build self_hash up from INLINE_STYLES
Browse files Browse the repository at this point in the history
Iterate over each value in INLINE_STYLES instead of iterating over
each value in instances_values and rejecting unwanted items.  This
version proceses fewer values and runs a little faster.

Issue randym#61 - Axlsx performance
  • Loading branch information
joekain committed Mar 31, 2012
1 parent a276aae commit 8190b14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/axlsx/workbook/worksheet/cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def initialize(row, value="", options={})
# equality comparison to test value, type and inline style attributes
# this is how we work out if the cell needs to be added or already exists in the shared strings table
def shareable_hash
self_hash = self.instance_values.reject { |key, val| !INLINE_STYLES.include?(key) }
self_hash = {}
INLINE_STYLES.each { |style| self_hash[style] = self.instance_variable_get("@" + style) }
self_hash['color'] = self_hash['color'].instance_values if self_hash['color']
self_hash
end
Expand Down

0 comments on commit 8190b14

Please sign in to comment.