Class: CSL::Style::Names

Inherits:
Node show all
Extended by:
InheritsNameOptions
Defined in:
lib/csl/style/names.rb

Instance Attribute Summary

Attributes inherited from Node

#attributes

Attributes included from Treelike

#children, #nodename, #parent

Instance Method Summary collapse

Methods included from InheritsNameOptions

inherits

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_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

#initialize(attributes = {}) {|_self| ... } ⇒ Names

Returns a new instance of Names.

Yields:

  • (_self)

Yield Parameters:



15
16
17
18
# File 'lib/csl/style/names.rb', line 15

def initialize(attributes = {})
  super(attributes)
  yield self if block_given?
end

Instance Method Details

#delimiter(node = nil, style = nil) ⇒ Object



24
25
26
27
28
# File 'lib/csl/style/names.rb', line 24

def delimiter(node = nil, style = nil)
  attributes.fetch(:delimiter) do
    inherited_names_options(node, style)[:delimiter] || ''
  end
end

#has_variable?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/csl/style/names.rb', line 30

def has_variable?
  attribute?(:variable)
end

#prefix_label?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/csl/style/names.rb', line 20

def prefix_label?
  has_label? && has_name? && children.index(label) < children.index(name)
end

#variableObject



34
35
36
# File 'lib/csl/style/names.rb', line 34

def variable
  attributes[:variable].to_s
end