Class: CSL::Style::Sort::Key

Inherits:
Node show all
Defined in:
lib/csl/style/sort.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes

Attributes included from Treelike

#children, #nodename, #parent

Instance Method Summary collapse

Methods inherited from Node

#<=>, #attribute?, #attributes?, #attributes_for, constantize, create, create_attributes, #custom_attributes, #deep_copy, #default_attribute?, #default_attributes, default_attributes, #each, #exact_match?, #format_page_ranges?, #formatting_options, #has_attributes?, #has_default_attributes?, #has_language?, hide_default_attributes!, hide_default_attributes?, #initialize, #initialize_copy, #inspect, match?, #match?, matches?, #merge!, #page_range_format, parse, parse!, #quotes?, #reverse_merge!, #save_to, show_default_attributes!, #strip_periods?, #tags, #textnode?, types

Methods included from Extensions::Nesting

#nesting

Methods included from PrettyPrinter

#pretty_print, #tags, #to_xml

Methods included from Treelike

#<<, #add_child, #add_children, #ancestors, #closest, #delete_child, #delete_children, #depth, #descendants, #each_ancestor, #each_child, #each_descendant, #each_sibling, #empty?, #find_child, #find_children, #has_children?, #root, #root?, #siblings, #unlink

Constructor Details

This class inherits a constructor from CSL::Node

Instance Method Details

#ascending!Object



46
47
48
# File 'lib/csl/style/sort.rb', line 46

def ascending!
  attributes[:sort] = 'ascending'
end

#ascending?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/csl/style/sort.rb', line 42

def ascending?
  attributes[:sort] =~ /^ascending$/i
end

#descending!Object



54
55
56
# File 'lib/csl/style/sort.rb', line 54

def descending!
  attributes[:sort] = 'descending'
end

#descending?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/csl/style/sort.rb', line 50

def descending?
  !ascending?
end

#macroObject



62
63
64
65
66
67
# File 'lib/csl/style/sort.rb', line 62

def macro
  fail 'cannot resolve macro: not associated with style' unless
    !root? && root.respond_to?(:macros)

  root.macros[attributes[:macro].to_s]
end

#macro?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/csl/style/sort.rb', line 58

def macro?
  attribute? :macro
end

#name_optionsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/csl/style/sort.rb', line 27

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

#variableObject



69
70
71
# File 'lib/csl/style/sort.rb', line 69

def variable
  attributes[:variable]
end