Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5706: colon_fix.diff

File colon_fix.diff, 6.7 kB (added by bmitchell@backchannelmedia.com, 4 years ago)

Swap out warned colons for semi-colons in rev. 4791

  • activesupport/lib/active_support/inflector.rb

    old new  
    167167      "#{number}th" 
    168168    else 
    169169      case number.to_i % 10 
    170         when 1: "#{number}st" 
    171         when 2: "#{number}nd" 
    172         when 3: "#{number}rd" 
     170        when 1; "#{number}st" 
     171        when 2; "#{number}nd" 
     172        when 3; "#{number}rd" 
    173173        else    "#{number}th" 
    174174      end 
    175175    end 
  • activerecord/lib/active_record/validations.rb

    old new  
    258258      # whether or not to validate the record.  See #validates_each. 
    259259      def evaluate_condition(condition, record) 
    260260        case condition 
    261           when Symbol: record.send(condition) 
    262           when String: eval(condition, binding) 
     261          when Symbol; record.send(condition) 
     262          when String; eval(condition, binding) 
    263263          else 
    264264            if condition_block?(condition) 
    265265              condition.call(record) 
  • activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb

    old new  
    9797      #   add_lock! 'SELECT * FROM suppliers', :lock => ' FOR UPDATE' 
    9898      def add_lock!(sql, options) 
    9999        case lock = options[:lock] 
    100           when true:   sql << ' FOR UPDATE' 
    101           when String: sql << " #{lock}" 
     100          when true;   sql << ' FOR UPDATE' 
     101          when String; sql << " #{lock}" 
    102102        end 
    103103      end 
    104104 
  • activerecord/lib/active_record/connection_adapters/abstract_adapter.rb

    old new  
    5454      # This is false for all adapters but Firebird. 
    5555      def prefetch_primary_key?(table_name = nil) 
    5656        false 
    57       end 
     57      end     
    5858 
    5959      def reset_runtime #:nodoc: 
    6060        rt, @runtime = @runtime, 0 
  • activerecord/lib/active_record/connection_adapters/oracle_adapter.rb

    old new  
    496496      alias :define_a_column_pre_ar :define_a_column 
    497497      def define_a_column(i) 
    498498        case do_ocicall(@ctx) { @parms[i - 1].attrGet(OCI_ATTR_DATA_TYPE) } 
    499         when 8    : @stmt.defineByPos(i, String, 65535) # Read LONG values 
    500         when 187  : @stmt.defineByPos(i, OraDate) # Read TIMESTAMP values 
     499        when 8    ; @stmt.defineByPos(i, String, 65535) # Read LONG values 
     500        when 187  ; @stmt.defineByPos(i, OraDate) # Read TIMESTAMP values 
    501501        when 108 
    502502          if @parms[i - 1].attrGet(OCI_ATTR_TYPE_NAME) == 'XMLTYPE' 
    503503            @stmt.defineByPos(i, String, 65535) 
  • activerecord/lib/active_record/base.rb

    old new  
    19131913 
    19141914      def convert_number_column_value(value) 
    19151915        case value 
    1916           when FalseClass:
    1917           when TrueClass:  1 
    1918           when '':         nil 
     1916          when FalseClass;
     1917          when TrueClass;  1 
     1918          when '';         nil 
    19191919          else value 
    19201920        end 
    19211921      end 
  • activerecord/lib/active_record/schema_dumper.rb

    old new  
    5454        @connection.tables.sort.each do |tbl| 
    5555          next if ["schema_info", ignore_tables].flatten.any? do |ignored| 
    5656            case ignored 
    57             when String: tbl == ignored 
    58             when Regexp: tbl =~ ignored 
     57            when String; tbl == ignored 
     58            when Regexp; tbl =~ ignored 
    5959            else 
    6060              raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.' 
    6161            end 
  • actionpack/lib/action_view/helpers/number_helper.rb

    old new  
    8585      #   human_size(1234567890)   => 1.1 GB 
    8686      def number_to_human_size(size) 
    8787        case  
    88           when size == 1        : '1 Byte' 
    89           when size < 1.kilobyte: '%d Bytes' % size 
    90           when size < 1.megabyte: '%.1f KB'  % (size / 1.0.kilobyte) 
    91           when size < 1.gigabyte: '%.1f MB'  % (size / 1.0.megabyte) 
    92           when size < 1.terabyte: '%.1f GB'  % (size / 1.0.gigabyte) 
     88          when size == 1        ; '1 Byte' 
     89          when size < 1.kilobyte; '%d Bytes' % size 
     90          when size < 1.megabyte; '%.1f KB'  % (size / 1.0.kilobyte) 
     91          when size < 1.gigabyte; '%.1f MB'  % (size / 1.0.megabyte) 
     92          when size < 1.terabyte; '%.1f GB'  % (size / 1.0.gigabyte) 
    9393          else                    '%.1f TB'  % (size / 1.0.terabyte) 
    9494        end.sub('.0', '') 
    9595      rescue 
  • actionpack/lib/action_view/base.rb

    old new  
    383383      def find_template_extension_for(template_path) 
    384384        if match = delegate_template_exists?(template_path) 
    385385          match.first.to_sym 
    386         elsif erb_template_exists?(template_path):        :rhtml 
    387         elsif builder_template_exists?(template_path):    :rxml 
    388         elsif javascript_template_exists?(template_path): :rjs 
     386        elsif erb_template_exists?(template_path);        :rhtml 
     387        elsif builder_template_exists?(template_path);    :rxml 
     388        elsif javascript_template_exists?(template_path); :rjs 
    389389        else 
    390390          raise ActionViewError, "No rhtml, rxml, rjs or delegate template found for #{template_path} in #{@base_path}" 
    391391        end