summaryrefslogtreecommitdiff
path: root/ext/nkf/lib/kconv.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-17 12:59:57 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-08-17 12:59:57 +0000
commit311d02a322cf38b85405613e50ce36c3e5eaec6d (patch)
tree12f24c633140c462bee7d9ebc42207413e910ab5 /ext/nkf/lib/kconv.rb
parent1de10a2395e739395e0bd6141c38e797053bd2f3 (diff)
* ext/nkf/lib/kconv.rb: ensure that symbol_to_option is private_class_method
and all other methods are module_function fixed: [ruby-dev:26808] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf/lib/kconv.rb')
-rw-r--r--ext/nkf/lib/kconv.rb29
1 files changed, 9 insertions, 20 deletions
diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb
index d2136400285..a5fc9a28e72 100644
--- a/ext/nkf/lib/kconv.rb
+++ b/ext/nkf/lib/kconv.rb
@@ -118,7 +118,6 @@ module Kconv
nkf_opt = '-x -m0 %s %s %s' % [to, from, opt]
result = ::NKF::nkf( nkf_opt, str)
end
- module_function :conv
alias :kconv :conv
#
@@ -128,27 +127,22 @@ module Kconv
def tojis(str)
::NKF::nkf('-j', str)
end
- module_function :tojis
def toeuc(str)
::NKF::nkf('-e', str)
end
- module_function :toeuc
def tosjis(str)
::NKF::nkf('-s', str)
end
- module_function :tosjis
def toutf8(str)
::NKF::nkf('-w', str)
end
- module_function :toutf8
def toutf16(str)
::NKF::nkf('-w16', str)
end
- module_function :toutf16
alias :to_jis :tojis
alias :to_euc :toeuc
@@ -166,17 +160,14 @@ module Kconv
def guess(str)
::NKF::guess(str)
end
- module_function :guess
def guess_old(str)
::NKF::guess1(str)
end
- module_function :guess_old
def guess_as_symbol(str)
CONSTANT_TO_SYMBOL[guess(str)]
end
- module_function :guess_as_symbol
#
# isEncoding
@@ -185,17 +176,14 @@ module Kconv
def iseuc(str)
RegexpEucjp.match( str )
end
- module_function :iseuc
def issjis(str)
RegexpShiftjis.match( str )
end
- module_function :issjis
def isutf8(str)
RegexpUtf8.match( str )
end
- module_function :isutf8
#
# encoding?
@@ -204,26 +192,21 @@ module Kconv
def eucjp?(str)
RegexpEucjp.match( str ) ? true : false
end
- module_function :eucjp?
def shiftjis?(str)
RegexpShiftjis.match( str ) ? true : false
end
- module_function :shiftjis?
+
def utf8?(str)
RegexpUtf8.match( str ) ? true : false
end
- module_function :utf8?
+
alias :euc? :eucjp?
alias :sjis? :shiftjis?
- module_function :euc?
- module_function :sjis?
-
#
# Private Methods
#
- private
def symbol_to_option(symbol)
if symbol.is_a? Integer
symbol = CONSTANT_TO_SYMBOL[symbol]
@@ -236,7 +219,13 @@ module Kconv
return nil
end
end
- module_function :symbol_to_option
+
+ #
+ # Make them module functions
+ #
+ module_function(*instance_methods(false))
+ private_class_method :symbol_to_option
+
end
class String