Project

General

Profile

Patch #32542 » 0001-Fix-ruby-2.7-warning-The-last-argument-is-used-as-th.patch

Seiei Miyagi, 2019-12-02 09:11

View differences:

app/models/import.rb
240 240
    wrapper = settings['wrapper'].to_s
241 241
    csv_options[:quote_char] = wrapper if wrapper.size == 1
242 242

  
243
    CSV.foreach(filepath, csv_options) do |row|
243
    CSV.foreach(filepath, **csv_options) do |row|
244 244
      yield row if block_given?
245 245
    end
246 246
  end
lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
33 33
          attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
34 34

  
35 35
          has_many :attachments, lambda {order("#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC")},
36
                                 options.merge(:as => :container, :dependent => :destroy, :inverse_of => :container)
36
                                 **options, as: :container, dependent: :destroy, inverse_of: :container
37 37
          send :include, Redmine::Acts::Attachable::InstanceMethods
38 38
          before_save :attach_saved_attachments
39 39
          after_rollback :detach_saved_attachments
lib/redmine/i18n.rb
29 29
        ::I18n.t(*args)
30 30
      when 2
31 31
        if args.last.is_a?(Hash)
32
          ::I18n.t(*args)
32
          ::I18n.t(*args.first, **args.last)
33 33
        elsif args.last.is_a?(String)
34 34
          ::I18n.t(args.first, :value => args.last)
35 35
        else
......
57 57
    def ll(lang, str, arg=nil)
58 58
      options = arg.is_a?(Hash) ? arg : {:value => arg}
59 59
      locale = lang.to_s.gsub(%r{(.+)\-(.+)$}) { "#{$1}-#{$2.upcase}" }
60
      ::I18n.t(str.to_s, options.merge(:locale => locale))
60
      ::I18n.t(str.to_s, **options, locale: locale)
61 61
    end
62 62

  
63 63
    # Localizes the given args with user's language
......
70 70
      return nil unless date
71 71
      options = {}
72 72
      options[:format] = Setting.date_format unless Setting.date_format.blank?
73
      ::I18n.l(date.to_date, options)
73
      ::I18n.l(date.to_date, **options)
74 74
    end
75 75

  
76 76
    def format_time(time, include_date=true, user=nil)
......
80 80
      options[:format] = (Setting.time_format.blank? ? :time : Setting.time_format)
81 81
      time = time.to_time if time.is_a?(String)
82 82
      local = user.convert_time_to_user_timezone(time)
83
      (include_date ? "#{format_date(local)} " : "") + ::I18n.l(local, options)
83
      (include_date ? "#{format_date(local)} " : "") + ::I18n.l(local, **options)
84 84
    end
85 85

  
86 86
    def format_hours(hours)
(3-3/3)