Class: Rocx::Properties::ValueProperty
- Inherits:
-
BaseProperty
- Object
- BaseProperty
- Rocx::Properties::ValueProperty
- Defined in:
- lib/rocx/properties/value_property.rb
Direct Known Subclasses
Alignment, BooleanProperty, Effect, Emphasis, Expansion, Highlight, IntegerProperty, OnOffProperty, PhoneticGuideAlignment, PhoneticGuideLanguage, SectionType, 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.
6 7 8 9 |
# File 'lib/rocx/properties/value_property.rb', line 6 def initialize(value) @value = value raise ArgumentError, unless valid? end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/rocx/properties/value_property.rb', line 4 def value @value end |
Instance Method Details
#invalid_message ⇒ Object
15 16 17 |
# File 'lib/rocx/properties/value_property.rb', line 15 def "Invalid value for #{name}; acceptable values are #{ok_values.join(", ")} (provided: #{value.inspect})" end |
#render? ⇒ Boolean
19 20 21 |
# File 'lib/rocx/properties/value_property.rb', line 19 def render? !value.nil? end |
#to_xml(xml) ⇒ Object
23 24 25 |
# File 'lib/rocx/properties/value_property.rb', line 23 def to_xml(xml) xml["w"].public_send(tag, "w:val" => value) end |
#valid? ⇒ Boolean
11 12 13 |
# File 'lib/rocx/properties/value_property.rb', line 11 def valid? ok_values.member? value end |