Code Review
/
packages
/
precise
/
mcollective.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
68642a123f18ef6fc211f773fc7be97286667de5
[packages/precise/mcollective.git]
/
simple.rb
1
# Simple Locale tag implementation that computes subtags by simply splitting
2
# the locale tag at '-' occurences.
3
module I18n
4
module Locale
5
module Tag
6
class Simple
7
class << self
8
def tag(tag)
9
new(tag)
10
end
11
end
12
13
include Parents
14
15
attr_reader :tag
16
17
def initialize(*tag)
18
@tag = tag.join('-').to_sym
19
end
20
21
def subtags
22
@subtags = tag.to_s.split('-').map { |subtag| subtag.to_s }
23
end
24
25
def to_sym
26
tag
27
end
28
29
def to_s
30
tag.to_s
31
end
32
33
def to_a
34
subtags
35
end
36
end
37
end
38
end
39
end