Sha256: 5876a49deb6e6465089482374b62814ca996dc4a62096249ea91072d55827033

Contents?: true

Size: 773 Bytes

Versions: 9

Compression:

Stored size: 773 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 term_options
				attributes_for :term, :plural, :form
			end

			def has_value?
				attribute?(:value)
			end

			def value
				attributes[:value]
			end
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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