Module: CSL::DatePart
- Included in:
- Locale::DatePart, Style::DatePart
- Defined in:
- lib/csl/date_part.rb
Instance Method Summary collapse
- #day? ⇒ Boolean
- #form ⇒ Object
- #has_form? ⇒ Boolean
- #has_name? ⇒ Boolean
- #month? ⇒ Boolean
- #name ⇒ Object
- #range_delimiter ⇒ Object
- #year? ⇒ Boolean
Instance Method Details
#day? ⇒ Boolean
47 48 49 |
# File 'lib/csl/date_part.rb', line 47 def day? name =~ /day/i end |
#form ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/csl/date_part.rb', line 20 def form case when has_form? attributes[:form].to_s when day? 'numeric' else 'long' end end |
#has_form? ⇒ Boolean
16 17 18 |
# File 'lib/csl/date_part.rb', line 16 def has_form? attribute?(:form) end |
#has_name? ⇒ Boolean
8 9 10 |
# File 'lib/csl/date_part.rb', line 8 def has_name? attribute?(:name) end |
#month? ⇒ Boolean
43 44 45 |
# File 'lib/csl/date_part.rb', line 43 def month? name =~ /month/i end |
#name ⇒ Object
12 13 14 |
# File 'lib/csl/date_part.rb', line 12 def name attributes[:name].to_s end |
#range_delimiter ⇒ Object
4 5 6 |
# File 'lib/csl/date_part.rb', line 4 def range_delimiter attributes.fetch(:'range-delimiter', '') end |
#year? ⇒ Boolean
39 40 41 |
# File 'lib/csl/date_part.rb', line 39 def year? name =~ /year/i end |