[Hiki-cvs 1424] [971] use dot instead of double colon when call singleton methods

アーカイブの一覧に戻る

svnno****@sourc***** svnno****@sourc*****
2009年 8月 16日 (日) 00:19:35 JST


Revision: 971
          http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=971
Author:   okkez
Date:     2009-08-16 00:19:35 +0900 (Sun, 16 Aug 2009)

Log Message:
-----------
use dot instead of double colon when call singleton methods

Modified Paths:
--------------
    hiki/trunk/hiki/db/flatfile.rb
    hiki/trunk/hiki/page.rb
    hiki/trunk/hiki/plugin.rb
    hiki/trunk/hiki/session.rb
    hiki/trunk/hiki/util.rb
    hiki/trunk/misc/plugin/bbs.rb
    hiki/trunk/misc/plugin/comment.rb
    hiki/trunk/misc/plugin/its.rb
    hiki/trunk/misc/plugin/recent2.rb
    hiki/trunk/misc/plugin/trackback.rb

Modified: hiki/trunk/hiki/db/flatfile.rb
===================================================================
--- hiki/trunk/hiki/db/flatfile.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/hiki/db/flatfile.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -12,12 +12,12 @@
 
     def initialize( conf )
       @conf = conf
-      @pages_path = File::join(@conf.data_path, "text")
-      @backup_path = File::join(@conf.data_path, "backup")
-      @info_db = File::join(@conf.data_path, "info.db")
+      @pages_path = File.join(@conf.data_path, "text")
+      @backup_path = File.join(@conf.data_path, "backup")
+      @info_db = File.join(@conf.data_path, "info.db")
       create_missing_dirs
       create_infodb unless test(?e, @info_db)
-      @info = PTStore::new( @info_db )
+      @info = PTStore.new( @info_db )
     end
 
     def close_db
@@ -38,9 +38,9 @@
       create_info_default( page ) unless info_exist?( page )
 
       if update_timestamp
-        set_last_update( page, Time::now )
+        set_last_update( page, Time.now )
       end
-      File::open( filename, 'wb' ) do |f|
+      File.open( filename, 'wb' ) do |f|
         f.write( text.gsub(/\r\n/, "\n") )
       end
       true
@@ -51,7 +51,7 @@
         begin
           FileUtils.copy( textdir( page ), backupdir( page ), {:preserve => true} )
           delete_info( page )
-          File::unlink( textdir( page ) )
+          File.unlink( textdir( page ) )
         rescue
         end
       end
@@ -59,12 +59,12 @@
 
     def load( page )
       return nil unless exist?( page )
-      File::read( textdir( page ) )
+      File.read( textdir( page ) )
     end
 
     def load_backup( page )
       return nil unless backup_exist?( page )
-      File::read( backupdir( page ) )
+      File.read( backupdir( page ) )
     end
 
     def save( page, src, md5 )
@@ -81,7 +81,7 @@
 
     def pages
       Dir.glob( "#{@pages_path}/*" ).delete_if {|f| !test(?f, f.untaint)}.collect! {|f|
-        File::basename( f ).unescape
+        File.basename( f ).unescape
       }
     end
 
@@ -207,11 +207,11 @@
     end
 
     def create_infodb
-      @info = PTStore::new( @info_db )
+      @info = PTStore.new( @info_db )
       @info.transaction do
         pages.each do |a|
           r = default
-          r[:last_modified] = File::mtime( "#{@pages_path}/#{a.escape}".untaint )
+          r[:last_modified] = File.mtime( "#{@pages_path}/#{a.escape}".untaint )
           @info[a.escape]  = r
         end
       end
@@ -226,7 +226,7 @@
 
     def default
       { :count          => 0,
-        :last_modified  => Time::now,
+        :last_modified  => Time.now,
         :freeze         => false,
         :references     => [],
         :keyword        => [],
@@ -235,11 +235,11 @@
     end
 
     def textdir(s)
-      File::join(@pages_path, s.escape).untaint
+      File.join(@pages_path, s.escape).untaint
     end
 
     def backupdir(s)
-      File::join(@backup_path, s.escape).untaint
+      File.join(@backup_path, s.escape).untaint
     end
   end
 end

Modified: hiki/trunk/hiki/page.rb
===================================================================
--- hiki/trunk/hiki/page.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/hiki/page.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -23,7 +23,7 @@
     end
 
     def to_html
-      ERB::new( @template ).result( binding )
+      ERB.new( @template ).result( binding )
     end
 
     def process( plugin )
@@ -33,11 +33,11 @@
       @conf.save_config if @contents[:save_config]
       @headers = {}
       if @contents[:last_modified] and 'HEAD' ==****@cgi*****_method
-        @headers['Last-Modified']    = CGI::rfc1123_date(@contents[:last_modified])
+        @headers['Last-Modified']    = CGI.rfc1123_date(@contents[:last_modified])
       end
       @headers['type']     = 'text/html'
       if****@conf*****_agent?
-        @body = NKF::nkf( '-sE', @body ) if /EUC-JP/i =~ @conf.charset
+        @body = NKF.nkf( '-sE', @body ) if /EUC-JP/i =~ @conf.charset
         @headers['charset']          = 'Shift_JIS'
       else
         @headers['charset']          =****@conf*****

Modified: hiki/trunk/hiki/plugin.rb
===================================================================
--- hiki/trunk/hiki/plugin.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/hiki/plugin.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -337,43 +337,43 @@
       end
     end
 
-    def add_header_proc( block = Proc::new )
+    def add_header_proc( block = Proc.new )
       @header_procs << block
     end
 
-    def add_footer_proc( block = Proc::new )
+    def add_footer_proc( block = Proc.new )
       @footer_procs << block
     end
 
-    def add_update_proc( block = Proc::new )
+    def add_update_proc( block = Proc.new )
       @update_procs << block
     end
 
-    def add_delete_proc( block = Proc::new )
+    def add_delete_proc( block = Proc.new )
       @delete_procs << block
     end
 
-    def add_body_enter_proc( block = Proc::new )
+    def add_body_enter_proc( block = Proc.new )
       @body_enter_procs << block
     end
 
-    def add_page_attribute_proc( block = Proc::new )
+    def add_page_attribute_proc( block = Proc.new )
       @page_attribute_procs << block
     end
 
-    def add_body_leave_proc( block = Proc::new )
+    def add_body_leave_proc( block = Proc.new )
       @body_leave_procs << block
     end
 
-    def add_edit_proc( block = Proc::new )
+    def add_edit_proc( block = Proc.new )
       @edit_procs << block
     end
 
-    def add_form_proc( block = Proc::new )
+    def add_form_proc( block = Proc.new )
       @form_procs << block
     end
 
-    def add_menu_proc( block = Proc::new )
+    def add_menu_proc( block = Proc.new )
       @menu_procs << block
     end
 
@@ -385,14 +385,14 @@
       nil
     end
 
-    def add_conf_proc( key, label, block = Proc::new )
+    def add_conf_proc( key, label, block = Proc.new )
       return unless @mode =~ /^(conf|saveconf)$/
       @conf_keys << key unless @conf_keys.index( key )
       @conf_procs[key] = [label, block]
     end
 
     def set_tdiary_env
-      @date             = Time::now
+      @date             = Time.now
       @cookies          = []
 
       @options['cache_path']  =****@conf*****_path
@@ -403,7 +403,7 @@
 #      @options['html_title']  =****@conf*****_name
       @options['years']       = {}
       @options['diaries']     = nil,
-      @options['date']        = Time::now
+      @options['date']        = Time.now
 
       %w(cache_path mode years diaries date).each do |p|
         instance_variable_set("@#{p}", @options[p])

Modified: hiki/trunk/hiki/session.rb
===================================================================
--- hiki/trunk/hiki/session.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/hiki/session.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -75,8 +75,8 @@
     # (from cgi/session.rb)
     def create_new_id
       require 'digest/md5'
-      md5 = Digest::MD5::new
-      now = Time::now
+      md5 = Digest::MD5.new
+      now = Time.now
       md5.update(now.to_s)
       md5.update(String(now.usec))
       md5.update(String(rand(0)))

Modified: hiki/trunk/hiki/util.rb
===================================================================
--- hiki/trunk/hiki/util.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/hiki/util.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -272,7 +272,7 @@
                else
                  'e' # XXX what should we use?
                end
-        NKF::nkf("-m0 -#{from}#{to}", str)
+        NKF.nkf("-m0 -#{from}#{to}", str)
       end
     end
 

Modified: hiki/trunk/misc/plugin/bbs.rb
===================================================================
--- hiki/trunk/misc/plugin/bbs.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/misc/plugin/bbs.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -54,7 +54,7 @@
     if /^\{\{bbs\b(:?[^\}]*)?\}\}/ =~ l && flag == false
       if count == bbs_num
         content << "#{l}\n"
-        content << @conf.parser.heading( "#{subject} - #{name} (#{format_date(Time::now)})\n", bbs_level )
+        content << @conf.parser.heading( "#{subject} - #{name} (#{format_date(Time.now)})\n", bbs_level )
         content << "#{msg}\n"
         content << "{{comment}}\n"
         flag = true

Modified: hiki/trunk/misc/plugin/comment.rb
===================================================================
--- hiki/trunk/misc/plugin/comment.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/misc/plugin/comment.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -57,7 +57,7 @@
     if /^\{\{r?comment.*\}\}/ =~ l && flag == false
       if count == comment_no
         content << l if style == 1
-        content << "*#{format_date(Time::now)} #{name} : #{msg}\n"
+        content << "*#{format_date(Time.now)} #{name} : #{msg}\n"
         content << l if style == 0
         flag = true
       else

Modified: hiki/trunk/misc/plugin/its.rb
===================================================================
--- hiki/trunk/misc/plugin/its.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/misc/plugin/its.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -222,7 +222,7 @@
   text.sub!(/^:Version:.*/i, ":Version:#{version}")
   text.sub!(/^:Milestone:.*/i, ":Milestone:#{milestone}")
   unless comment.empty?
-    str =****@conf*****( "#{name} (#{format_date(Time::now)})\n", 3 )
+    str =****@conf*****( "#{name} (#{format_date(Time.now)})\n", 3 )
     str << comment
     text.sub!(/^\{\{its_edit_ticket_form\}\}/, "#{str}\\&")
   end

Modified: hiki/trunk/misc/plugin/recent2.rb
===================================================================
--- hiki/trunk/misc/plugin/recent2.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/misc/plugin/recent2.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -4,7 +4,7 @@
 def recent2( n = 20 )
   n = n > 0 ? n : 0
 
-  now = Time::now
+  now = Time.now
 
   l =****@db*****_info.sort do |a, b|
     b[b.keys[0]][:last_modified] <=> a[a.keys[0]][:last_modified]

Modified: hiki/trunk/misc/plugin/trackback.rb
===================================================================
--- hiki/trunk/misc/plugin/trackback.rb	2009-08-15 15:19:33 UTC (rev 970)
+++ hiki/trunk/misc/plugin/trackback.rb	2009-08-15 15:19:35 UTC (rev 971)
@@ -26,7 +26,7 @@
   lines.each do |l|
     if /^\{\{trackback\}\}/ =~ l && flag == false
       content << "#{l}\n"
-      content << %Q!* trackback : #{@conf.parser.link( url, "#{title} (#{blog_name})" )} (#{format_date(Time::now)})\n!
+      content << %Q!* trackback : #{@conf.parser.link( url, "#{title} (#{blog_name})" )} (#{format_date(Time.now)})\n!
       content << @conf.parser.blockquote( shorten( excerpt ) )
       flag = true
     else




Hiki-cvs メーリングリストの案内
アーカイブの一覧に戻る