summaryrefslogtreecommitdiff
path: root/ext/nkf/lib/kconv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/nkf/lib/kconv.rb')
-rw-r--r--ext/nkf/lib/kconv.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index bfd276330dc..af6d82275f7 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -56,3 +56,18 @@ module Kconv
end
module_function :guess
end
+
+class String
+ def kconv(out_code, in_code=Kconv::AUTO)
+ Kconv::kconv(self, out_code, in_code)
+ end
+ def tojis
+ NKF::nkf('-j', self)
+ end
+ def toeuc
+ NKF::nkf('-e', self)
+ end
+ def tosjis
+ NKF::nkf('-s', self)
+ end
+end