ruby-changes:35030
From: hsbt <ko1@a...>
Date: Sat, 9 Aug 2014 10:37:04 +0900 (JST)
Subject: [ruby-changes:35030] hsbt:r47112 (trunk): * lib/cmath.rb: fixed indent.
hsbt 2014-08-09 10:36:49 +0900 (Sat, 09 Aug 2014) New Revision: 47112 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47112 Log: * lib/cmath.rb: fixed indent. * lib/drb/ssl.rb: ditto. * lib/irb/**/*.rb: ditto. Modified files: trunk/ChangeLog trunk/lib/cmath.rb trunk/lib/drb/ssl.rb trunk/lib/irb/cmd/chws.rb trunk/lib/irb/cmd/fork.rb trunk/lib/irb/cmd/load.rb trunk/lib/irb/cmd/nop.rb trunk/lib/irb/cmd/pushws.rb trunk/lib/irb/cmd/subirb.rb trunk/lib/irb/completion.rb trunk/lib/irb/context.rb trunk/lib/irb/ext/change-ws.rb trunk/lib/irb/ext/history.rb trunk/lib/irb/ext/loader.rb trunk/lib/irb/ext/math-mode.rb trunk/lib/irb/ext/multi-irb.rb trunk/lib/irb/ext/save-history.rb trunk/lib/irb/ext/tracer.rb trunk/lib/irb/ext/use-loader.rb trunk/lib/irb/ext/workspaces.rb trunk/lib/irb/extend-command.rb trunk/lib/irb/frame.rb trunk/lib/irb/help.rb trunk/lib/irb/init.rb trunk/lib/irb/input-method.rb trunk/lib/irb/locale.rb trunk/lib/irb/notifier.rb trunk/lib/irb/ruby-lex.rb trunk/lib/irb/ruby-token.rb trunk/lib/irb/slex.rb trunk/lib/irb/workspace.rb trunk/lib/irb/xmp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47111) +++ ChangeLog (revision 47112) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Aug 9 10:35:30 2014 Laurent Arnoud <laurent@s...> + + * lib/cmath.rb: fixed indent. + * lib/drb/ssl.rb: ditto. + * lib/irb/**/*.rb: ditto. + Sat Aug 9 10:28:03 2014 SHIBATA Hiroshi <shibata.hiroshi@g...> * test/minitest/test_minitest_unit.rb: removed obsoleted condition Index: lib/irb/input-method.rb =================================================================== --- lib/irb/input-method.rb (revision 47111) +++ lib/irb/input-method.rb (revision 47112) @@ -133,14 +133,14 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L133 include Readline # Creates a new input method object using Readline def initialize - super + super - @line_no = 0 - @line = [] - @eof = false + @line_no = 0 + @line = [] + @eof = false - @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") - @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") + @stdin = IO.open(STDIN.to_i, :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") + @stdout = IO.open(STDOUT.to_i, 'w', :external_encoding => IRB.conf[:LC_MESSAGES].encoding, :internal_encoding => "-") end # Reads the next line from this input method. @@ -149,13 +149,13 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L149 def gets Readline.input = @stdin Readline.output = @stdout - if l = readline(@prompt, false) - HISTORY.push(l) if !l.empty? - @line[@line_no += 1] = l + "\n" - else - @eof = true - l - end + if l = readline(@prompt, false) + HISTORY.push(l) if !l.empty? + @line[@line_no += 1] = l + "\n" + else + @eof = true + l + end end # Whether the end of this input method has been reached, returns +true+ @@ -163,7 +163,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L163 # # See IO#eof? for more information. def eof? - @eof + @eof end # Whether this input method is still readable when there is no more data to @@ -171,7 +171,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L171 # # See IO#eof for more information. def readable_after_eof? - true + true end # Returns the current line number for #io. @@ -180,12 +180,12 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/input-method.rb#L180 # # See IO#lineno for more information. def line(line_no) - @line[line_no] + @line[line_no] end # The external encoding for standard input. def encoding - @stdin.external_encoding + @stdin.external_encoding end end rescue LoadError Index: lib/irb/notifier.rb =================================================================== --- lib/irb/notifier.rb (revision 47111) +++ lib/irb/notifier.rb (revision 47112) @@ -40,8 +40,8 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L40 class AbstractNotifier # Creates a new Notifier object def initialize(prefix, base_notifier) - @prefix = prefix - @base_notifier = base_notifier + @prefix = prefix + @base_notifier = base_notifier end # The +prefix+ for this Notifier, which is appended to all objects being @@ -52,38 +52,38 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L52 # # Defaults to +true+. def notify? - true + true end # See OutputMethod#print for more detail. def print(*opts) - @base_notifier.print prefix, *opts if notify? + @base_notifier.print prefix, *opts if notify? end # See OutputMethod#printn for more detail. def printn(*opts) - @base_notifier.printn prefix, *opts if notify? + @base_notifier.printn prefix, *opts if notify? end # See OutputMethod#printf for more detail. def printf(format, *opts) - @base_notifier.printf(prefix + format, *opts) if notify? + @base_notifier.printf(prefix + format, *opts) if notify? end # See OutputMethod#puts for more detail. def puts(*objs) - if notify? - @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s}) - end + if notify? + @base_notifier.puts(*objs.collect{|obj| prefix + obj.to_s}) + end end # Same as #ppx, except it uses the #prefix given during object # initialization. # See OutputMethod#ppx for more detail. def pp(*objs) - if notify? - @base_notifier.ppx @prefix, *objs - end + if notify? + @base_notifier.ppx @prefix, *objs + end end # Same as #pp, except it concatenates the given +prefix+ with the #prefix @@ -91,14 +91,14 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L91 # # See OutputMethod#ppx for more detail. def ppx(prefix, *objs) - if notify? - @base_notifier.ppx @prefix+prefix, *objs - end + if notify? + @base_notifier.ppx @prefix+prefix, *objs + end end # Execute the given block if notifications are enabled. def exec_if - yield(@base_notifier) if notify? + yield(@base_notifier) if notify? end end @@ -116,10 +116,10 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L116 # Create a new composite notifier object with the given +prefix+, and # +base_notifier+ to use for output. def initialize(prefix, base_notifier) - super + super - @notifiers = [D_NOMSG] - @level_notifier = D_NOMSG + @notifiers = [D_NOMSG] + @level_notifier = D_NOMSG end # List of notifiers in the group @@ -132,9 +132,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L132 # # This method returns the newly created instance. def def_notifier(level, prefix = "") - notifier = LeveledNotifier.new(self, level, prefix) - @notifiers[level] = notifier - notifier + notifier = LeveledNotifier.new(self, level, prefix) + @notifiers[level] = notifier + notifier end # Returns the leveled notifier for this object @@ -156,16 +156,16 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L156 # found in the existing #notifiers Array, or an instance of # AbstractNotifier def level_notifier=(value) - case value - when AbstractNotifier - @level_notifier = value - when Integer - l = @notifiers[value] - Notifier.Raise ErrUndefinedNotifier, value unless l - @level_notifier = l - else - Notifier.Raise ErrUnrecognizedLevel, value unless l - end + case value + when AbstractNotifier + @level_notifier = value + when Integer + l = @notifiers[value] + Notifier.Raise ErrUndefinedNotifier, value unless l + @level_notifier = l + else + Notifier.Raise ErrUnrecognizedLevel, value unless l + end end alias level= level_notifier= @@ -183,9 +183,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L183 # CompositeNotifier group to determine whether or not to output # notifications. def initialize(base, level, prefix) - super(prefix, base) + super(prefix, base) - @level = level + @level = level end # The current level of this notifier object @@ -196,13 +196,13 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L196 # # See the Comparable module for more information. def <=>(other) - @level <=> other.level + @level <=> other.level end # Whether to output messages to the output method, depending on the level # of this notifier object. def notify? - @base_notifier.level >= self + @base_notifier.level >= self end end @@ -214,15 +214,15 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/notifier.rb#L214 class NoMsgNotifier<LeveledNotifier # Creates a new notifier that should not be used to output messages. def initialize - @base_notifier = nil - @level = 0 - @prefix = "" + @base_notifier = nil + @level = 0 + @prefix = "" end # Ensures notifications are ignored, see AbstractNotifier#notify? for # more information. def notify? - false + false end end Index: lib/irb/context.rb =================================================================== --- lib/irb/context.rb (revision 47111) +++ lib/irb/context.rb (revision 47112) @@ -25,12 +25,12 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L25 def initialize(irb, workspace = nil, input_method = nil, output_method = nil) @irb = irb if workspace - @workspace = workspace + @workspace = workspace else - @workspace = WorkSpace.new + @workspace = WorkSpace.new end @thread = Thread.current if defined? Thread -# @irb_level = 0 + # @irb_level = 0 # copy of default configuration @ap_name = IRB.conf[:AP_NAME] @@ -55,50 +55,50 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L55 self.prompt_mode = IRB.conf[:PROMPT_MODE] if IRB.conf[:SINGLE_IRB] or !defined?(IRB::JobManager) - @irb_name = IRB.conf[:IRB_NAME] + @irb_name = IRB.conf[:IRB_NAME] else - @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s + @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s end @irb_path = "(" + @irb_name + ")" case input_method when nil - case use_readline? - when nil - if (defined?(ReadlineInputMethod) && STDIN.tty? && - IRB.conf[:PROMPT_MODE] != :INF_RUBY) - @io = ReadlineInputMethod.new - else - @io = StdioInputMethod.new - end - when false - @io = StdioInputMethod.new - when true - if defined?(ReadlineInputMethod) - @io = ReadlineInputMethod.new - else - @io = StdioInputMethod.new - end - end + case use_readline? + when nil + if (defined?(ReadlineInputMethod) && STDIN.tty? && + IRB.conf[:PROMPT_MODE] != :INF_RUBY) + @io = ReadlineInputMethod.new + else + @io = StdioInputMethod.new + end + when false + @io = StdioInputMethod.new + when true + if defined?(ReadlineInputMethod) + @io = ReadlineInputMethod.new + else + @io = StdioInputMethod.new + end + end when String - @io = FileInputMethod.new(input_method) - @irb_name = File.basename(input_method) - @irb_path = input_method + @io = FileInputMethod.new(input_method) + @irb_name = File.basename(input_method) + @irb_path = input_method else - @io = input_method + @io = input_method end self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY] if output_method - @output_method = output_method + @output_method = output_method else - @output_method = StdioOutputMethod.new + @output_method = StdioOutputMethod.new end @echo = IRB.conf[:ECHO] if @echo.nil? - @echo = true + @echo = true end self.debug_level = IRB.conf[:DEBUG_LEVEL] end @@ -235,15 +235,15 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L235 # Returns whether messages are displayed or not. def verbose? if @verbose.nil? - if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod) - false - elsif !STDIN.tty? or @io.kind_of?(FileInputMethod) - true - else - false - end + if defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod) + false + elsif !STDIN.tty? or @io.kind_of?(FileInputMethod) + true + else + false + end else - @verbose + @verbose end end @@ -251,7 +251,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L251 # StdioInputMethod or ReadlineInputMethod, see #io for more information. def prompting? verbose? || (STDIN.tty? && @io.kind_of?(StdioInputMethod) || - (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod))) + (defined?(ReadlineInputMethod) && @io.kind_of?(ReadlineInputMethod))) end # The return value of the last statement evaluated. @@ -276,9 +276,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L276 @prompt_n = pconf[:PROMPT_N] @return_format = pconf[:RETURN] if ai = pconf.include?(:AUTO_INDENT) - @auto_indent_mode = ai + @auto_indent_mode = ai else - @auto_indent_mode = IRB.conf[:AUTO_INDENT] + @auto_indent_mode = IRB.conf[:AUTO_INDENT] end end @@ -309,41 +309,41 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L309 def inspect_mode=(opt) if i = Inspector::INSPECTORS[opt] - @inspect_mode = opt - @inspect_method = i - i.init + @inspect_mode = opt + @inspect_method = i + i.init else - case opt - when nil - if Inspector.keys_with_inspector(Inspector::INSPECTORS[true]).include?(@inspect_mode) - self.inspect_mode = false - elsif Inspector.keys_with_inspector(Inspector::INSPECTORS[false]).include?(@inspect_mode) - self.inspect_mode = true - else - puts "Can't switch inspect mode." - return - end - when /^\s*\{.*\}\s*$/ - begin - inspector = eval "proc#{opt}" - rescue Exception - puts "Can't switch inspect mode(#{opt})." - return - end - self.inspect_mode = inspector - when Proc - self.inspect_mode = IRB::Inspector(opt) - when Inspector - prefix = "usr%d" - i = 1 - while Inspector::INSPECTORS[format(prefix, i)]; i += 1; end - @inspect_mode = format(prefix, i) - @inspect_method = opt - Inspector.def_inspector(format(prefix, i), @inspect_method) - else - puts "Can't switch inspect mode(#{opt})." - return - end + case opt + when nil + if Inspector.keys_with_inspector(Inspector::INSPECTORS[true]).include?(@inspect_mode) + self.inspect_mode = false + elsif Inspector.keys_with_inspector(Inspector::INSPECTORS[false]).include?(@inspect_mode) + self.inspect_mode = true + else + puts "Can't switch inspect mode." + return + end + when /^\s*\{.*\}\s*$/ + begin + inspector = eval "proc#{opt}" + rescue Exception + puts "Can't switch inspect mode(#{opt})." + return + end + self.inspect_mode = inspector + when Proc + self.inspect_mode = IRB::Inspector(opt) + when Inspector + prefix = "usr%d" + i = 1 + while Inspector::INSPECTORS[format(prefix, i)]; i += 1; end + @inspect_mode = format(prefix, i) + @inspect_method = opt + Inspector.def_inspector(format(prefix, i), @inspect_method) + else + puts "Can't switch inspect mode(#{opt})." + return + end end print "Switch to#{unless @inspect_mode; ' non';end} inspect mode.\n" if verbose? @inspect_mode @@ -378,8 +378,8 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L378 def evaluate(line, line_no) # :nodoc: @line_no = line_no set_last_value(@workspace.evaluate(self, line, irb_path, line_no)) -# @workspace.evaluate("_ = IRB.conf[:MAIN_CONTEXT]._") -# @_ = @workspace.evaluate(line, irb_path, line_no) + # @workspace.evaluate("_ = IRB.conf[:MAIN_CONTEXT]._") + # @_ = @workspace.evaluate(line, irb_path, line_no) end def inspect_last_value # :nodoc: @@ -400,19 +400,19 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/context.rb#L400 def inspect # :nodoc: array = [] for ivar in instance_variables.sort{|e1, e2| e1 <=> e2} - ivar = ivar.to_s - name = ivar.sub(/^@(.*)$/, '\1') - val = instance_eval(ivar) - case ivar - when *NOPRINTING_IVARS - array.push format("conf.%s=%s", name, "...") - when *NO_INSPECTING_IVARS - array.push format("conf.%s=%s", name, val.to_s) - when *IDNAME_IVARS - array.push format("conf.%s=:%s", name, val.id2name) - else - array.push format("conf.%s=%s", name, val.inspect) - end + ivar = ivar.to_s + name = ivar.sub(/^@(.*)$/, '\1') + val = instance_eval(ivar) + case ivar + when *NOPRINTING_IVARS + array.push format("conf.%s=%s", name, "...") + when *NO_INSPECTING_IVARS + array.push format("conf.%s=%s", name, val.to_s) + when *IDNAME_IVARS + array.push format("conf.%s=:%s", name, val.id2name) + else + array.push format("conf.%s=%s", name, val.inspect) + end end array.join("\n") end Index: lib/irb/help.rb =================================================================== --- lib/irb/help.rb (revision 47111) +++ lib/irb/help.rb (revision 47112) @@ -19,16 +19,16 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/help.rb#L19 space_line = false IRB::MagicFile.open(path){|f| f.each_line do |l| - if /^\s*$/ =~ l - lc.puts l unless space_line - space_line = true - next - end - space_line = false + if /^\s*$/ =~ l + lc.puts l unless space_line + space_line = true + next + end + space_line = false - l.sub!(/#.*$/, "") - next if /^\s*$/ =~ l - lc.puts l + l.sub!(/#.*$/, "") + next if /^\s*$/ =~ l + lc.puts l end } end Index: lib/irb/frame.rb =================================================================== --- lib/irb/frame.rb (revision 47111) +++ lib/irb/frame.rb (revision 47112) @@ -31,9 +31,9 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/frame.rb#L31 def trace_func(event, file, line, id, binding) case event when 'call', 'class' - @frames.push binding + @frames.push binding when 'return', 'end' - @frames.pop + @frames.pop end end Index: lib/irb/workspace.rb =================================================================== --- lib/irb/workspace.rb (revision 47111) +++ lib/irb/workspace.rb (revision 47112) @@ -16,61 +16,61 @@ module IRB # :nodoc: https://github.com/ruby/ruby/blob/trunk/lib/irb/workspace.rb#L16 # inherit main from TOPLEVEL_BINDING. def initialize(*main) if main[0].kind_of?(Binding) - @binding = main.shift + @binding = main.shift elsif IRB.conf[:SINGLE_IRB] - @binding = TOPLEVEL_BINDING + @binding = TOPLEVEL_BINDING else - case IRB.conf[:CONTEXT_MODE] - when 0 # binding in proc on TOPLEVEL_BINDING - @binding = eval("proc{binding}.call", - TOPLEVEL_BINDING, - __FILE__, - __LINE__) - when 1 # binding in loaded file - require "tempfile" - f = Tempfile.open("irb-binding") - f.print <<EOF - $binding = binding + case IRB.conf[:CONTEXT_MODE] + when 0 # binding in proc on TOPLEVEL_BINDING + @binding = eval("proc{binding}.call", + TOPLEVEL_BINDING, + __FILE__, + __LINE__) + when 1 # binding in loaded file + require "tempfile" + (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/