Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / lib / mcollective / vendor / i18n / lib / i18n / locale / tag / simple.rb
diff --git a/lib/mcollective/vendor/i18n/lib/i18n/locale/tag/simple.rb b/lib/mcollective/vendor/i18n/lib/i18n/locale/tag/simple.rb
new file mode 100644 (file)
index 0000000..68642a1
--- /dev/null
@@ -0,0 +1,39 @@
+# Simple Locale tag implementation that computes subtags by simply splitting
+# the locale tag at '-' occurences.
+module I18n
+  module Locale
+    module Tag
+      class Simple
+        class << self
+          def tag(tag)
+            new(tag)
+          end
+        end
+
+        include Parents
+
+        attr_reader :tag
+
+        def initialize(*tag)
+          @tag = tag.join('-').to_sym
+        end
+
+        def subtags
+          @subtags = tag.to_s.split('-').map { |subtag| subtag.to_s }
+        end
+
+        def to_sym
+          tag
+        end
+
+        def to_s
+          tag.to_s
+        end
+
+        def to_a
+          subtags
+        end
+      end
+    end
+  end
+end