Sha256: 3d6d16a03080402bbbb1a5b1681b9903e5974e45fdb69cbc9f766772d4692267

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

module Forewarn
  module Warners
    class StringMutation
      def message
        "String mutation method"
      end

      def methods
        method_names.map { |m| String.instance_method(m) }
      end

    private

      def method_names
        String.instance_methods.select { |method_name|
          method_name.to_s.end_with?('!')
        } + [
          :"[]=", :"<<", :clear, :concat, :extend, :insert,
          :instance_variable_set, :prepend, :replace, :setbyte, :taint
        ] - [
          :"!" # <-- lol BasicObject#! is A-okay.
        ]

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
forewarn-0.1.0 lib/forewarn/warners/string_mutation.rb