Class: CSL::Style::Number
Overview
Numbers are CSL rendering elements which output the number variable selected with the required variable attribute.
Instance Attribute Summary
Attributes inherited from Node
Attributes included from Treelike
Instance Method Summary collapse
- #form ⇒ Object
- #has_form? ⇒ Boolean
- #has_variable? ⇒ Boolean
-
#long_ordinal? ⇒ Boolean
Whether or not the number’s format is set to ‘long-ordinal’.
-
#numeric? ⇒ Boolean
Whether or not the number’s format is set to :numeric; also returns true if the number’s form attribute is not set or nil.
-
#ordinal? ⇒ Boolean
Whether or not the number’s format is set to ‘ordinal.
-
#roman? ⇒ Boolean
Whether or not the number’s format is set to ‘roman’.
- #variable ⇒ Object
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
Methods included from PrettyPrinter
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
#form ⇒ Object
23 24 25 |
# File 'lib/csl/style/number.rb', line 23 def form attributes[:form].to_s end |
#has_form? ⇒ Boolean
19 20 21 |
# File 'lib/csl/style/number.rb', line 19 def has_form? attribute?(:form) end |
#has_variable? ⇒ Boolean
11 12 13 |
# File 'lib/csl/style/number.rb', line 11 def has_variable? attribute?(:variable) end |
#long_ordinal? ⇒ Boolean
Returns whether or not the number’s format is set to ‘long-ordinal’.
40 41 42 |
# File 'lib/csl/style/number.rb', line 40 def long_ordinal? has_form? && form == 'long-ordinal' end |
#numeric? ⇒ Boolean
Returns whether or not the number’s format is set to :numeric; also returns true if the number’s form attribute is not set or nil.
30 31 32 |
# File 'lib/csl/style/number.rb', line 30 def numeric? !has_form? || form == 'numeric' end |
#ordinal? ⇒ Boolean
Returns whether or not the number’s format is set to ‘ordinal.
35 36 37 |
# File 'lib/csl/style/number.rb', line 35 def ordinal? has_form? && form == 'ordinal' end |
#roman? ⇒ Boolean
Returns whether or not the number’s format is set to ‘roman’.
45 46 47 |
# File 'lib/csl/style/number.rb', line 45 def roman? has_form? && form == 'roman' end |
#variable ⇒ Object
15 16 17 |
# File 'lib/csl/style/number.rb', line 15 def variable attributes[:variable] end |