Sha256: 6d8ec2f3ab7e453ba1246937e6ed61793d3387c73b84f3e03f20826b34b58781
Contents?: true
Size: 1.67 KB
Versions: 18
Compression:
Stored size: 1.67 KB
Contents
module CSL class Style class Sort < Node #attr_children :key #alias_child :sort_keys, :key def initialize(attributes = {}) super(attributes) yield self if block_given? end alias sort_keys children alias sort_keys? has_children? alias has_sort_keys? has_children? class Key < Node attr_struct :variable, :macro, :sort, :'names-min', :'names-use-first', :'names-use-last' attr_defaults :sort => 'ascending' has_no_children def name_options options = {} options[:'et-al-min'] = options[:'et-al-subsequent-min'] = attributes[:'names-min'] if attribute? :'names-min' options[:'et-al-use-first'] = options[:'et-al-subsequent-use-first'] = attributes[:'names-use-first'] if attribute? :'names-use-first' options[:'et-al-use-last'] = options[:'et-al-subsequent-use-last'] = attributes[:'names-use-last'] if attribute? :'names-use-last' options end def ascending? attributes[:sort] =~ /^ascending$/i end def ascending! attributes[:sort] = 'ascending' end def descending? !ascending? end def descending! attributes[:sort] = 'descending' end def macro? attribute? :macro end def macro fail 'cannot resolve macro: not associated with style' unless !root? && root.respond_to?(:macros) root.macros[attributes[:macro].to_s] end def variable attributes[:variable] end end end end end
Version data entries
18 entries across 18 versions & 1 rubygems