openxml/openxml-docx

View on GitHub
lib/openxml/docx/properties/on_off_property.rb

Summary

Maintainability
A
0 mins
Test Coverage
module OpenXml
  module Docx
    module Properties
      class OnOffProperty < ValueProperty

        def ok_values
          [true, false, :on, :off] # :on and :off are from the Transitional Spec
        end

        def to_xml(xml)
          return xml["w"].public_send(tag) if value == true
          xml["w"].public_send(tag, "w:val" => value)
        end

      end
    end
  end
end