Results for: "to_proc"

Provides 3 methods for declaring when something is going away.

+deprecate(name, repl, year, month)+:

Indicate something may be removed on/after a certain date.

+rubygems_deprecate(name, replacement=:none)+:

Indicate something will be removed in the next major RubyGems version,
and (optionally) a replacement for it.

rubygems_deprecate_command:

Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
removed in the next RubyGems version.

Also provides skip_during for temporarily turning off deprecation warnings. This is intended to be used in the test suite, so deprecation warnings don’t cause test failures if you need to make sure stderr is otherwise empty.

Example usage of deprecate and rubygems_deprecate:

class Legacy
  def self.some_class_method
    # ...
  end

  def some_instance_method
    # ...
  end

  def some_old_method
    # ...
  end

  extend Gem::Deprecate
  deprecate :some_instance_method, "X.z", 2011, 4
  rubygems_deprecate :some_old_method, "Modern#some_new_method"

  class << self
    extend Gem::Deprecate
    deprecate :some_class_method, :none, 2011, 4
  end
end

Example usage of rubygems_deprecate_command:

class Gem::Commands::QueryCommand < Gem::Command
  extend Gem::Deprecate
  rubygems_deprecate_command

  # ...
end

Example usage of skip_during:

class TestSomething < Gem::Testcase
  def test_some_thing_with_deprecations
    Gem::Deprecate.skip_during do
      actual_stdout, actual_stderr = capture_output do
        Gem.something_deprecated
      end
      assert_empty actual_stdout
      assert_equal(expected, actual_stderr)
    end
  end
end

Mixin methods for local and remote Gem::Command options.

No documentation available
No documentation available

Generator

Response class for Payload Too Large responses (status code 413).

The request is larger than the server is willing or able to process.

References:

Response class for URI Too Long responses (status code 414).

The URI provided was too long for the server to process.

References:

Response class for Too Many Requests responses (status code 429).

The user has sent too many requests in a given amount of time.

References:

Response class for Insufficient Storage (WebDAV) responses (status code 507).

The server is unable to store the representation needed to complete the request.

References:

No documentation available

Represents the use of an assignment operator on a call.

foo.bar += baz
^^^^^^^^^^^^^^

Represents assigning to a class variable using an operator that isn’t ‘=`.

@@target += value
^^^^^^^^^^^^^^^^^

Represents the use of the ‘||=` operator for assignment to a constant.

Target ||= value
^^^^^^^^^^^^^^^^

Represents assigning to a constant path using an operator that isn’t ‘=`.

Parent::Child += value
^^^^^^^^^^^^^^^^^^^^^^

Represents assigning to a global variable using an operator that isn’t ‘=`.

$target += value
^^^^^^^^^^^^^^^^

Represents the use of an assignment operator on a call to ‘[]`.

foo.bar[baz] += value
^^^^^^^^^^^^^^^^^^^^^

Represents assigning to an instance variable using an operator that isn’t ‘=`.

@target += value
^^^^^^^^^^^^^^^^

Represents a singleton class declaration involving the ‘class` keyword.

class << self end
^^^^^^^^^^^^^^^^^

This represents a token from the Ruby source.

A class that knows how to walk down the tree. None of the individual visit methods are implemented on this visitor, so it forces the consumer to implement each one that they need. For a default implementation that continues walking the tree, see the Visitor class.

A visitor is a class that provides a default implementation for every accept method defined on the nodes. This means it can walk a tree without the caller needing to define any special handling. This allows you to handle a subset of the tree, while still walking the whole tree.

For example, to find all of the method calls that call the ‘foo` method, you could write:

class FooCalls < Prism::Visitor
  def visit_call_node(node)
    if node.name == "foo"
      # Do something with the node
    end

    # Call super so that the visitor continues walking the tree
    super
  end
end
No documentation available
No documentation available

Validator performs various gem file and gem database validation

Scans up/down from the given block

You can try out a change, stash it, or commit it to save for later

Example:

scanner = ScanHistory.new(code_lines: code_lines, block: block)
scanner.scan(
  up: ->(_, _, _) { true },
  down: ->(_, _, _) { true }
)
scanner.changed? # => true
expect(scanner.lines).to eq(code_lines)

scanner.stash_changes

expect(scanner.lines).to_not eq(code_lines)
Search took: 4ms  ·  Total Results: 1894