Sha256: 0a71976007dfa287bd48b1e1f32b0ce8047d8c33bcbb88a70d1a483c11d3733f

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

module CSL
  class Style

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

      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

2 entries across 2 versions & 1 rubygems

Version Path
csl-1.0.0.pre23 lib/csl/style/text.rb
csl-1.0.0.pre22 lib/csl/style/text.rb