Sha256: 42ed4f96cdb8bb08c9a55f280e3c84d567ef4f4ac2eb778acad62a3eebe6c7ae

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 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

      # @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?
        !attribute?(:form) || attributes.form.to_sym == :numeric
      end

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

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

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

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
csl-1.0.0.pre8 lib/csl/style/number.rb
csl-1.0.0.pre7 lib/csl/style/number.rb