Sha256: 1005b41936c6208067d7f3bfac88f95206cb1b9024c70b441267e413ef052816

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 Bytes

Contents

module CSL
  class Style

    class Text < Node
      attr_struct :variable, :macro, :term, :form, :plural, :value,
				:quotes, :'strip-periods', *Schema.attr(:formatting)

      has_no_children

      def has_variable?
        attribute?(:variable)
      end

      def variable
        attributes[:variable]
      end
      
      def variable_options
        attributes_for :form
      end

      def has_macro?
        attribute?(:macro)
      end

      # @return [Macro, nil]
      def macro
        raise unless parent.respond_to?(:macros)
        parent.macros[attributes[:macro]]
      end

      def has_term?
        attribute?(:term)
      end

      def has_value?
        attribute?(:value)
      end

      def value
        attributes[:value]
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
csl-1.0.2 lib/csl/style/text.rb
csl-1.0.1 lib/csl/style/text.rb
csl-1.0.0 lib/csl/style/text.rb