Class: String Private
- Defined in:
- lib/stub_requests/core_ext/object/blank.rb,
lib/stub_requests/core_ext/string/to_route_param.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
:nodoc:
Instance Method Summary collapse
-
#blank? ⇒ Boolean
:nodoc:.
-
#to_route_param ⇒ Object
private
:nodoc:.
Instance Method Details
#blank? ⇒ Boolean
:nodoc:
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/stub_requests/core_ext/object/blank.rb', line 76 def blank? # The regexp that matches blank strings is expensive. For the case of empty # strings we can speed up this method (~3.5x) with an empty? call. The # penalty for the rest of strings is marginal. empty? || begin if RUBY_VERSION >= "2.4" BLANK_RE.match?(self) else !!BLANK_RE.match(self) end rescue Encoding::CompatibilityError if RUBY_VERSION >= "2.4" ENCODED_BLANKS[encoding].match?(self) else !!ENCODED_BLANKS[encoding].match(self) end end end |
#to_route_param ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
:nodoc:
8 9 10 11 12 |
# File 'lib/stub_requests/core_ext/string/to_route_param.rb', line 8 def to_route_param return self if start_with?(":") ":#{+self}" end |