instance method _expression_to_callable

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

_expression_to_callable(callable_or_ruby_source, binding)

No documentation comment.

Parameters

callable_or_ruby_source req
binding req
Source
# File activesupport/lib/active_support/testing/assertions.rb, line 369
        def _expression_to_callable(callable_or_ruby_source, binding)
          return callable_or_ruby_source if callable_or_ruby_source.respond_to?(:call)

          case callable_or_ruby_source
          when String, Symbol
            -> { eval(callable_or_ruby_source.to_s, binding) }
          else
            raise ArgumentError, "The expression must be a callable object like a Proc, or a String of Ruby code. Got #{callable_or_ruby_source.inspect}"
          end
        end

Defined in activesupport/lib/active_support/testing/assertions.rb line 369 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Testing::Assertions

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close