Class: OpenXml::Docx::Properties::OnOffProperty

Inherits:
ValueProperty show all
Defined in:
lib/openxml/docx/properties/on_off_property.rb

Instance Attribute Summary

Attributes inherited from ValueProperty

#value

Attributes inherited from BaseProperty

#value

Instance Method Summary collapse

Methods inherited from ValueProperty

#initialize, #invalid_message, #render?, #valid?

Methods inherited from BaseProperty

#default_name, #default_namespace, #default_tag, #initialize, name, #name, #namespace, namespace, #render?, #tag, tag, tag_is_one_of

Constructor Details

This class inherits a constructor from OpenXml::Docx::Properties::ValueProperty

Instance Method Details

#ok_valuesObject


6
7
8
# File 'lib/openxml/docx/properties/on_off_property.rb', line 6

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

#to_xml(xml) ⇒ Object


10
11
12
13
# File 'lib/openxml/docx/properties/on_off_property.rb', line 10

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