Class: OpenXml::Properties::OnOffProperty

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

Direct Known Subclasses

ToggleProperty

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_tag, #initialize, #name, name, namespace, #namespace, #render?, tag, #tag, tag_is_one_of, #validate_tag

Constructor Details

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

Instance Method Details

#ok_valuesObject



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

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

#to_xml(xml) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/openxml/properties/on_off_property.rb', line 9

def to_xml(xml)
  if value == true
    apply_namespace(xml).public_send(tag) do
      yield xml if block_given?
    end
  else
    super
  end
end