Sha256: 7ddb135973b5cb65b5db0afa6ef917e2b5e4aa476c17e644fffa8912c9ba08ff

Contents?: true

Size: 856 Bytes

Versions: 19

Compression:

Stored size: 856 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 "failed to resolve macro #{attributes[:macro].inspect}" unless
          !root? && root.respond_to?(:macros)

        root.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

19 entries across 19 versions & 1 rubygems

Version Path
csl-2.0.0 lib/csl/style/text.rb
csl-1.6.0 lib/csl/style/text.rb
csl-1.5.2 lib/csl/style/text.rb
csl-1.5.1 lib/csl/style/text.rb
csl-1.5.0 lib/csl/style/text.rb
csl-1.4.5 lib/csl/style/text.rb
csl-1.4.4 lib/csl/style/text.rb
csl-1.4.3 lib/csl/style/text.rb
csl-1.4.2 lib/csl/style/text.rb
csl-1.4.1 lib/csl/style/text.rb
csl-1.4.0 lib/csl/style/text.rb
csl-1.3.2 lib/csl/style/text.rb
csl-1.3.1 lib/csl/style/text.rb
csl-1.3.0 lib/csl/style/text.rb
csl-1.2.3 lib/csl/style/text.rb
csl-1.2.2 lib/csl/style/text.rb
csl-1.2.1 lib/csl/style/text.rb
csl-1.2.0 lib/csl/style/text.rb
csl-1.1.0 lib/csl/style/text.rb