lib/csl/style/number.rb in csl-1.0.0.pre23 vs lib/csl/style/number.rb in csl-1.0.0
- old
+ new
@@ -2,12 +2,11 @@
class Style
# Numbers are CSL rendering elements which output the number variable
# selected with the required variable attribute.
class Number < Node
- attr_struct :variable, :form, :'text-case',
- *Schema.attr(:affixes, :display, :font)
+ attr_struct :variable, :form, *Schema.attr(:formatting)
has_no_children
def has_variable?
attribute?(:variable)
@@ -20,32 +19,32 @@
def has_form?
attribute?(:form)
end
def form
- attributes[:form]
+ attributes[:form].to_s
end
# @return [Boolean] whether or not the number's format is set to
# :numeric; also returns true if the number's form attribute is not
# set or nil.
def numeric?
- !has_form? || form.to_sym == :numeric
+ !has_form? || form == 'numeric'
end
- # @return [Boolean] whether or not the number's format is set to :ordinal
+ # @return [Boolean] whether or not the number's format is set to 'ordinal
def ordinal?
- has_form? && form.to_sym == :ordinal
+ has_form? && form == 'ordinal'
end
- # @return [Boolean] whether or not the number's format is set to :'long-ordinal'
+ # @return [Boolean] whether or not the number's format is set to 'long-ordinal'
def long_ordinal?
- has_form? && form.to_sym == :'long-ordinal'
+ has_form? && form == 'long-ordinal'
end
- # @return [Boolean] whether or not the number's format is set to :roman
+ # @return [Boolean] whether or not the number's format is set to 'roman'
def roman?
- has_form? && form.to_sym == :roman
+ has_form? && form == 'roman'
end
end
end
end
\ No newline at end of file