lib/csl/locale/date.rb in csl-1.0.0.pre21 vs lib/csl/locale/date.rb in csl-1.0.0.pre22
- old
+ new
@@ -1,27 +1,27 @@
module CSL
class Locale
# A localized Date comprises a set of formatting rules for dates.
- class Date < Node
+ class Date < Node
- attr_struct :form, *Schema.attr(:formatting, :delimiter)
- attr_children :'date-part'
+ attr_struct :form, *Schema.attr(:formatting, :delimiter)
+ attr_children :'date-part'
- alias parts date_part
- alias locale parent
+ alias parts date_part
+ alias locale parent
- def initialize(attributes = {})
- super(attributes)
- children[:'date-part'] = []
+ def initialize(attributes = {})
+ super(attributes)
+ children[:'date-part'] = []
- yield self if block_given?
- end
+ yield self if block_given?
+ end
- def added_to(node)
- raise ValidationError, "parent must be locale node: was #{node.inspect}" unless node.is_a?(Locale)
- end
+ def added_to(node)
+ raise ValidationError, "parent must be locale node: was #{node.inspect}" unless node.is_a?(Locale)
+ end
def delimiter
attributes.fetch(:delimiter, '')
end
@@ -44,21 +44,21 @@
def has_date_parts?
!date_parts.empty?
end
alias has_parts? has_date_parts?
- end
+ end
- # DatePart represent the localized formatting options for an individual
- # date part (day, month, or year).
- class DatePart < Node
+ # DatePart represent the localized formatting options for an individual
+ # date part (day, month, or year).
+ class DatePart < Node
has_no_children
attr_struct :name, :form, :'range-delimiter',
*Schema.attr(:formatting, :periods)
include CSL::DatePart
- end
+ end
end
end