Skip to content

Commit

Permalink
Allow #blank? instance method on results ⬜️
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny committed May 21, 2024
1 parent 8a42d73 commit c2e59f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## unreleased

Fixes:
- Add `#nil?` method to `ServiceActor::Result` (#146)
- Add `#nil?` and `#blank?` methods to `ServiceActor::Result` (#146)
- Accept inputs called `error` (#146)

## v3.9.1
Expand Down
5 changes: 4 additions & 1 deletion lib/service_actor/result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def to_result(data)
end

%i[
blank?
block_given?
class
instance_variables
Expand All @@ -24,7 +25,9 @@ def to_result(data)
tap
then
].each do |method_name|
define_method(method_name, ::Kernel.instance_method(method_name))
if ::Kernel.instance_methods.include?(method_name)
define_method(method_name, ::Kernel.instance_method(method_name))
end
end

alias_method :yield_self, :then
Expand Down

0 comments on commit c2e59f4

Please sign in to comment.