Sha256: 8f44fd05a7af75da1e35df195e998292a492e84880d2104156930e53a2b3bde2

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

module CSL
  class Style

    class Number < Node
      attr_struct :variable, :form, :'text-case',
        *Schema.attr(:affixes, :display, :font)

      has_no_children

			def has_variable?
				attribute?(:variable)
			end

			def variable
				attributes[:variable]
			end

			def has_form?
				attribute?(:form)
			end

			def form
				attributes[:form]
			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
      end

      # @return [Boolean] whether or not the number's format is set to :ordinal
      def ordinal?
				has_form? && form.to_sym == :ordinal
      end

      # @return [Boolean] whether or not the number's format is set to :'long-ordinal'
      def long_ordinal?
        has_form? && form.to_sym == :'long-ordinal'
      end

      # @return [Boolean] whether or not the number's format is set to :roman
      def roman?
        has_form? && form.to_sym == :roman
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
csl-1.0.0.pre15 lib/csl/style/number.rb
csl-1.0.0.pre14 lib/csl/style/number.rb
csl-1.0.0.pre13 lib/csl/style/number.rb
csl-1.0.0.pre12 lib/csl/style/number.rb
csl-1.0.0.pre11 lib/csl/style/number.rb
csl-1.0.0.pre10 lib/csl/style/number.rb
csl-1.0.0.pre9 lib/csl/style/number.rb