Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / lib / mcollective / vendor / i18n / lib / i18n / locale / tag / parents.rb
diff --git a/lib/mcollective/vendor/i18n/lib/i18n/locale/tag/parents.rb b/lib/mcollective/vendor/i18n/lib/i18n/locale/tag/parents.rb
new file mode 100644 (file)
index 0000000..ec53060
--- /dev/null
@@ -0,0 +1,22 @@
+module I18n
+  module Locale
+    module Tag
+      module Parents
+        def parent
+          @parent ||= begin
+            segs = to_a.compact
+            segs.length > 1 ? self.class.tag(*segs[0..(segs.length-2)].join('-')) : nil
+          end
+        end
+
+        def self_and_parents
+          @self_and_parents ||= [self] + parents
+        end
+
+        def parents
+          @parents ||= ([parent] + (parent ? parent.parents : [])).compact
+        end
+      end
+    end
+  end
+end