summaryrefslogtreecommitdiff
path: root/lib/irb/locale.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 01:36:49 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 01:36:49 +0000
commit8e5af8b628b2a52d203e43ad5a8b18375f801cde (patch)
tree457d72a0f7ac4ea97949ec5b317b359a7d776089 /lib/irb/locale.rb
parent45592f4b4c7e835881538e52172932c3e20d0c4d (diff)
* lib/cmath.rb: fixed indent.
* lib/drb/ssl.rb: ditto. * lib/irb/**/*.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/locale.rb')
-rw-r--r--lib/irb/locale.rb68
1 files changed, 34 insertions, 34 deletions
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index d463258fc8..aaccbce3d4 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -26,15 +26,15 @@ module IRB # :nodoc:
@lang = @territory = @encoding_name = @modifier = nil
@locale = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
if m = LOCALE_NAME_RE.match(@locale)
- @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier]
-
- if @encoding_name
- begin load 'irb/encoding_aliases.rb'; rescue LoadError; end
- if @encoding = @@legacy_encoding_alias_map[@encoding_name]
- warn "%s is obsolete. use %s" % ["#{@lang}_#{@territory}.#{@encoding_name}", "#{@lang}_#{@territory}.#{@encoding.name}"]
- end
- @encoding = Encoding.find(@encoding_name) rescue nil
- end
+ @lang, @territory, @encoding_name, @modifier = m[:language], m[:territory], m[:codeset], m[:modifier]
+
+ if @encoding_name
+ begin load 'irb/encoding_aliases.rb'; rescue LoadError; end
+ if @encoding = @@legacy_encoding_alias_map[@encoding_name]
+ warn "%s is obsolete. use %s" % ["#{@lang}_#{@territory}.#{@encoding_name}", "#{@lang}_#{@territory}.#{@encoding.name}"]
+ end
+ @encoding = Encoding.find(@encoding_name) rescue nil
+ end
end
@encoding ||= (Encoding.find('locale') rescue Encoding::ASCII_8BIT)
end
@@ -44,9 +44,9 @@ module IRB # :nodoc:
def String(mes)
mes = super(mes)
if @encoding
- mes.encode(@encoding, undef: :replace)
+ mes.encode(@encoding, undef: :replace)
else
- mes
+ mes
end
end
@@ -83,22 +83,22 @@ module IRB # :nodoc:
case file
when /\.rb$/
- begin
- load(file, priv)
- $".push file
- return true
- rescue LoadError
- end
+ begin
+ load(file, priv)
+ $".push file
+ return true
+ rescue LoadError
+ end
when /\.(so|o|sl)$/
- return super
+ return super
end
begin
- load(f = file + ".rb")
- $".push f #"
- return true
+ load(f = file + ".rb")
+ $".push f #"
+ return true
rescue LoadError
- return ruby_require(file)
+ return ruby_require(file)
end
end
@@ -129,9 +129,9 @@ module IRB # :nodoc:
def real_load(path, priv)
src = MagicFile.open(path){|f| f.read}
if priv
- eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)})
+ eval("self", TOPLEVEL_BINDING).extend(Module.new {eval(src, nil, path)})
else
- eval(src, TOPLEVEL_BINDING, path)
+ eval(src, TOPLEVEL_BINDING, path)
end
end
@@ -161,20 +161,20 @@ module IRB # :nodoc:
def each_sublocale
if @lang
- if @territory
- if @encoding_name
- yield "#{@lang}_#{@territory}.#{@encoding_name}@#{@modifier}" if @modifier
- yield "#{@lang}_#{@territory}.#{@encoding_name}"
- end
- yield "#{@lang}_#{@territory}@#{@modifier}" if @modifier
- yield "#{@lang}_#{@territory}"
- end
+ if @territory
+ if @encoding_name
+ yield "#{@lang}_#{@territory}.#{@encoding_name}@#{@modifier}" if @modifier
+ yield "#{@lang}_#{@territory}.#{@encoding_name}"
+ end
+ yield "#{@lang}_#{@territory}@#{@modifier}" if @modifier
+ yield "#{@lang}_#{@territory}"
+ end
if @encoding_name
yield "#{@lang}.#{@encoding_name}@#{@modifier}" if @modifier
yield "#{@lang}.#{@encoding_name}"
end
- yield "#{@lang}@#{@modifier}" if @modifier
- yield "#{@lang}"
+ yield "#{@lang}@#{@modifier}" if @modifier
+ yield "#{@lang}"
end
yield nil
end