diff options
| author | Randy Morgan <[email protected]> | 2012-04-01 11:58:09 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-01 11:58:09 +0900 |
| commit | 1529fce32449a8454208fded20d83c9ceca810e0 (patch) | |
| tree | 02f722182fea58a51b8c0a5433221b3a677e80e4 /lib/axlsx/stylesheet/cell_protection.rb | |
| parent | 22a341841f191a5aa00e87b1f166b4f25cc67f0a (diff) | |
| download | caxlsx-1529fce32449a8454208fded20d83c9ceca810e0.tar.gz caxlsx-1529fce32449a8454208fded20d83c9ceca810e0.zip | |
rebuild all serialization to use string concatenation instead of nokogiri.
Diffstat (limited to 'lib/axlsx/stylesheet/cell_protection.rb')
| -rw-r--r-- | lib/axlsx/stylesheet/cell_protection.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/axlsx/stylesheet/cell_protection.rb b/lib/axlsx/stylesheet/cell_protection.rb index 89d85289..b874b214 100644 --- a/lib/axlsx/stylesheet/cell_protection.rb +++ b/lib/axlsx/stylesheet/cell_protection.rb @@ -4,7 +4,7 @@ module Axlsx # @note Using Styles#add_style is the recommended way to manage cell protection. # @see Styles#add_style class CellProtection - + # specifies locking for cells that have the style containing this protection # @return [Boolean] attr_reader :hidden @@ -23,9 +23,15 @@ module Axlsx end # @see hidden - def hidden=(v) Axlsx::validate_boolean v; @hidden = v end + def hidden=(v) Axlsx::validate_boolean v; @hidden = v end # @see locked - def locked=(v) Axlsx::validate_boolean v; @locked = v end + def locked=(v) Axlsx::validate_boolean v; @locked = v end + + def to_xml_string(str = '') + str << '<protection ' + str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ') + str << '/>' + end # Serializes the cell protection # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. |
