Module: CSL::DatePart

Included in:
Locale::DatePart, Style::DatePart
Defined in:
lib/csl/date_part.rb

Instance Method Summary collapse

Instance Method Details

#day?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/csl/date_part.rb', line 47

def day?
  name =~ /day/i
end

#formObject



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

Returns:

  • (Boolean)


16
17
18
# File 'lib/csl/date_part.rb', line 16

def has_form?
  attribute?(:form)
end

#has_name?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/csl/date_part.rb', line 8

def has_name?
  attribute?(:name)
end

#month?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/csl/date_part.rb', line 43

def month?
  name =~ /month/i
end

#nameObject



12
13
14
# File 'lib/csl/date_part.rb', line 12

def name
  attributes[:name].to_s
end

#range_delimiterObject



4
5
6
# File 'lib/csl/date_part.rb', line 4

def range_delimiter
  attributes.fetch(:'range-delimiter', '')
end

#year?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/csl/date_part.rb', line 39

def year?
  name =~ /year/i
end