Class: CSL::Style::Date
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_copy, #inspect, match?, #match?, matches?, #merge!, #page_range_format, parse, parse!, #quotes?, #reverse_merge!, #save_to, show_default_attributes!, #strip_periods?, #tags, #textnode?, types
#nesting
#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| ... } ⇒ Date
Returns a new instance of Date.
17
18
19
20
21
22
|
# File 'lib/csl/style/date.rb', line 17
def initialize(attributes = {})
super(attributes, &nil)
children[:'date-part'] = []
yield self if block_given?
end
|
Instance Method Details
#date_parts_filter ⇒ Array<String>
Also known as:
parts_filter
Returns the localized date parts to be used.
25
26
27
|
# File 'lib/csl/style/date.rb', line 25
def date_parts_filter
attributes[:'date-parts'].to_s.split(/-/)
end
|
#delimiter ⇒ Object
30
31
32
|
# File 'lib/csl/style/date.rb', line 30
def delimiter
attributes.fetch(:delimiter, '')
end
|
47
48
49
|
# File 'lib/csl/style/date.rb', line 47
def form
attributes[:form].to_s
end
|
#has_date_parts? ⇒ Boolean
Also known as:
has_parts?
59
60
61
|
# File 'lib/csl/style/date.rb', line 59
def has_date_parts?
!date_parts.empty?
end
|
42
43
44
|
# File 'lib/csl/style/date.rb', line 42
def has_form?
attribute?(:form)
end
|
#has_overrides? ⇒ Boolean
64
65
66
|
# File 'lib/csl/style/date.rb', line 64
def has_overrides?
localized? && has_parts?
end
|
#has_variable? ⇒ Boolean
34
35
36
|
# File 'lib/csl/style/date.rb', line 34
def has_variable?
attribute?(:variable)
end
|
#numeric? ⇒ Boolean
51
52
53
|
# File 'lib/csl/style/date.rb', line 51
def numeric?
form =~ /^numeric$/i
end
|
#text? ⇒ Boolean
55
56
57
|
# File 'lib/csl/style/date.rb', line 55
def text?
form =~ /^text$/i
end
|
38
39
40
|
# File 'lib/csl/style/date.rb', line 38
def variable
attributes[:variable]
end
|