rubocop:enable Metrics/AbcSize
 rubocop:enable Metrics/CyclomaticComplexity
 rubocop:enable Metrics/PerceivedComplexity
 :nodoc:
431326
def build_year_rules(rule, expression)
      rule = rule.year(*expression.year) unless expression.year.blank?
      rule = rule.month_of_year(*expression.month) unless expression.month.blank?

      rule
    end
14298
def start_accepting_passive_svc_checks(self):
        
        # todo: #783 create a dedicated brok for global parameters
        if not self.my_conf.accept_passive_service_checks:
            self.my_conf.modified_attributes |= DICT_MODATTR["MODATTR_PASSIVE_CHECKS_ENABLED"].value
            self.my_conf.accept_passive_service_checks = True
            self.my_conf.explode_global_conf()
            self.daemon.update_program_status()
654446
def load_and_verify(verify_element, url_hash = nil)
      result = true
      @metrics.start_time
      if url_hash.nil?
        load
      else
        load(url_hash)
      end
      if verify_element
        result = wait_till_element_visible(verify_element, 3)
      end
      @metrics.log_metric(@page_name, 'load', verify_element)
      result
    end
1055257
def ensure_hash(ambiguous_param)
      case ambiguous_param
        when String
          if ambiguous_param.present?
            ensure_hash(JSON.parse(ambiguous_param))
          else
            {}
          end
        when Hash, ActionController::Parameters
          ambiguous_param
        when nil
          {}
        else
          raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
      end
    end
730916
def load!
      begin
        require name unless enabled?
      rescue LoadError => error
        puts("Unable to load plugin #{name} due to #{error}.")
      rescue => error
        puts("require '#{name}' failed with #{error}")
      end
      @enabled = true
    end
1299527
def initialize_metal
      Rails::Rack::Metal.requested_metals = configuration.metals
      Rails::Rack::Metal.metal_paths = ["#{TRUSTY_CMS_ROOT}/app/metal"] # reset Rails default to TRUSTY_CMS_ROOT
      Rails::Rack::Metal.metal_paths += plugin_loader.engine_metal_paths
      Rails::Rack::Metal.metal_paths += extension_loader.paths(:metal)
      Rails::Rack::Metal.metal_paths.uniq!

      configuration.middleware.insert_before(
        :"ActionController::ParamsParser",
        Rails::Rack::Metal, :if => Rails::Rack::Metal.metals.any?)
    end
711089
def initialize_default_cfvos(user_cfvos)
      defaults = self.class.default_cfvos
      user_cfvos.each_with_index do |cfvo, index|
        if index < defaults.size
          cfvo = defaults[index].merge(cfvo)
        end
        add cfvo
      end
      while colors.size < defaults.size
        add defaults[colors.size - 1]
      end
    end
103544
def instantiate(pinfo, opts={})

      return nil unless pinfo

      pa_class_name, options = pinfo

      if rp = options['require_path']
        require(rp)
      end
      if lp = options['load_path']
        load(lp)
      end

      pa_class = Ruote.constantize(pa_class_name)
      pa_m = pa_class.instance_methods

      irt = opts[:if_respond_to?]

      if irt && ! (pa_m.include?(irt.to_s) || pa_m.include?(irt.to_sym))
        return nil
      end

      initialize_participant(pa_class, options)
    end
856697
def init_with(environment, coder, asset_options = {})
      asset_options[:bundle] = false

      super(environment, coder)

      @source = coder['source']
      @dependency_digest = coder['dependency_digest']

      @required_assets = coder['required_paths'].map { |p|
        p = expand_root_path(p)

        unless environment.paths.detect { |path| p[path] }
          raise UnserializeError, "#{p} isn't in paths"
        end

        p == pathname.to_s ? self : environment.find_asset(p, asset_options)
      }
      @dependency_paths = coder['dependency_paths'].map { |h|
        DependencyFile.new(expand_root_path(h['path']), h['mtime'], h['digest'])
      }
    end
727992
def start
      if defined?(JRUBY_VERSION)
        unless options[:no_interactions]
          abort "\nSorry, JRuby and interactive mode are incompatible.\n"\
            "As a workaround, use the '-i' option instead.\n\n"\
            "More info: \n"\
            " * https://github.com/guard/guard/issues/754\n"\
            " * https://github.com/jruby/jruby/issues/2383\n\n"
        end
      end
      exit(Cli::Environments::Valid.new(options).start_guard)
    end
1261913
def init_vars
      @quit_key ||= FFI::NCurses::KEY_F10
      # actually this should be maintained inside ncurses pack, so not loaded 2 times.
      # this way if we call an app from existing program, App won't start ncurses.
      unless $ncurses_started
        init_ncurses
      end
      $lastline = Ncurses.LINES - 1
      unless $log
        logpath=ENV["CANIS_LOG_PATH"]
        $log = create_logger(logpath || "/dev/null")
      end
    end
590571
def initialize(self, cfg_file=None, mode=None):
        
        self.sim = ScipyOdeSimulator(self.model)
        self.state = numpy.array(copy.copy(self.sim.initials)[0])
        self.time = numpy.array(0.0)
        self.status = 'initialized'
847711
def feature_params
        if Rails.version.to_i < 5
          ActiveSupport::HashWithIndifferentAccess.new(params[:feature])
        else
          params.require(:feature).permit(:name, :description, :state)
        end
      end
1246600
def *(other)
      if other.is_a?(InternalComplex) or other.is_a?(Complex)
        InternalComplex.new @real * other.real - @imag * other.imag,
                    @real * other.imag + @imag * other.real
      elsif InternalComplex.generic? other
        InternalComplex.new @real * other, @imag * other
      else
        x, y = other.coerce self
        x * y
      end
    end
725462
def method_missing(method_name, *args, &block)
      config = Loquacious::Configuration.for method_name, &block
      raise Adhearsion::Configuration::ConfigurationError.new "Invalid plugin #{method_name}" if config.nil?
      config
    end
855851
def add_discerner_user_method
      current_user_helper = options["current-user-helper"].presence ||
                            ask("What is the current_user helper called in your app? [current_user]").presence ||
                            'current_user if defined?(current_user)'
      puts "Defining discerner_user method inside ApplicationController..."

      discerner_user_method = %Q{
  def discerner_user
    #{current_user_helper}
  end
  helper_method :discerner_user
}
      inject_into_file("#{Rails.root}/app/controllers/application_controller.rb",
                       discerner_user_method,
                       after: "ActionController::Base\n", force: false)
    end
35528
def <<(patch)
      known_patch = @patches[patch.name]
      if known_patch.nil?
        @patches[patch.name] = patch
      elsif patch.content != known_patch.content
        raise ContradictionError, [known_patch, patch]
      end
    end