lib/csl/locale.rb in csl-1.0.0.pre2 vs lib/csl/locale.rb in csl-1.0.0.pre3
- old
+ new
@@ -2,10 +2,11 @@
#
# CSL::Locales contain locale specific date formatting options, term
# translations, and a number ordinalizer.
#
class Locale < Node
+ types << CSL::Info
include Comparable
@default = 'en-US'.freeze
@@ -28,11 +29,10 @@
AT de BR pt CA en CH de GB en
}.map(&:to_sym)]).freeze
class << self
-
include Loader
attr_accessor :default
attr_reader :languages, :regions
@@ -41,24 +41,23 @@
raise ParseError, "root node is not a locale: #{node.inspect}" unless
node.is_a?(self)
node
- end
-
+ end
end
attr_defaults :version => Schema.version, :xmlns => Schema.namespace
attr_struct :xmlns, :version
attr_children :'style-options', :info, :date, :terms
attr_accessor :language, :region
- alias metadata info
- alias dates date
- alias options style_options
+ alias_child :metadata, :info
+ alias_child :dates, :date
+ alias_child :options, :style_options
private :attributes
undef_method :[]=
# call-seq:
@@ -91,11 +90,11 @@
attributes, locale, options = {}, *arguments
else
raise ArgumentError, "wrong number of arguments (#{arguments.length} for 0..2)"
end
- super(attributes)
+ super(attributes, &nil)
set(locale) unless locale.nil?
unless options.nil?
children[:'style-options'] = StyleOptions.new(options)
@@ -358,10 +357,10 @@
[language, region].compact.join('-')
end
# @return [String] a string representation of the Locale
def inspect
- "#<#{self.class.name} #{to_s}: dates=[#{dates.length}] terms=[#{terms.length}]>"
+ "#<#{self.class.name} #{to_s}>"
end
private
def attribute_assignments
\ No newline at end of file