Class: OpenXml::Docx::Properties::ValueProperty
- Inherits:
-
BaseProperty
- Object
- BaseProperty
- OpenXml::Docx::Properties::ValueProperty
- Defined in:
- lib/openxml/docx/properties/value_property.rb
Direct Known Subclasses
Alignment, BooleanProperty, Effect, Emphasis, Expansion, Highlight, IntegerProperty, LinkedStyle, NextStyle, OnOffProperty, ParentStyle, PhoneticGuideAlignment, PhoneticGuideLanguage, SectionType, StringProperty, Style, TextAlignment, TextDirection, TextboxTightWrap, ToggleProperty, VerticalAlignment, VerticalTextAlignment
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ ValueProperty
constructor
A new instance of ValueProperty.
- #invalid_message ⇒ Object
- #render? ⇒ Boolean
- #to_xml(xml) ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from BaseProperty
#default_name, #default_tag, name, #name, tag, #tag
Constructor Details
#initialize(value) ⇒ ValueProperty
Returns a new instance of ValueProperty.
7 8 9 10 |
# File 'lib/openxml/docx/properties/value_property.rb', line 7 def initialize(value) @value = value raise ArgumentError, unless valid? end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/openxml/docx/properties/value_property.rb', line 5 def value @value end |
Instance Method Details
#invalid_message ⇒ Object
16 17 18 |
# File 'lib/openxml/docx/properties/value_property.rb', line 16 def "Invalid value for #{name}; acceptable values are #{ok_values.join(", ")} (provided: #{value.inspect})" end |
#render? ⇒ Boolean
20 21 22 |
# File 'lib/openxml/docx/properties/value_property.rb', line 20 def render? !value.nil? end |
#to_xml(xml) ⇒ Object
24 25 26 |
# File 'lib/openxml/docx/properties/value_property.rb', line 24 def to_xml(xml) xml["w"].public_send(tag, "w:val" => value) end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/openxml/docx/properties/value_property.rb', line 12 def valid? ok_values.member? value end |