lib/rocx/properties/alignment.rb in rocx-0.5.7 vs lib/rocx/properties/alignment.rb in rocx-0.5.8

- old
+ new

@@ -1,26 +1,11 @@ module Rocx module Properties - class Alignment < BaseProperty - attr_reader :value + class Alignment < ValueProperty + tag :jc - OK_VALUES = [:both, :center, :distribute, :end, :highKashida, :lowKashida, :mediumKashida, :numTab, :start, :thaiDistribute] - - def initialize(value) - @value = value - raise ArgumentError invalid_message unless valid? - end - - def invalid_message - "Invalid value for alignment; acceptable values are #{OK_VALUES.join(", ")}" - end - - def valid? - OK_VALUES.member? value - end - - def to_xml(xml) - xml["w"].jc("w:val" => value) if value + def ok_values + [:both, :center, :distribute, :end, :highKashida, :lowKashida, :mediumKashida, :numTab, :start, :thaiDistribute] end end end end