Skip to content

Commit

Permalink
feat(has_instance_proxy): introduce #inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
marian13 committed Jan 13, 2024
1 parent e9026ee commit 078d219
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,23 @@ def call
# # end
#
klass.class_exec(target_class) do |target_class|
##
# @return [Class]
#
define_singleton_method(:target_class) { target_class }

##
# @return [Boolean, nil]
#
# @internal
# TODO: Try `self.target_class == other.target_class if self < ::ConvenientService::Common::Plugins::HasInstanceProxy::Entities::InstanceProxy`.
#
define_singleton_method(:==) { |other| self.target_class == other.target_class if other.respond_to?(:target_class) }

##
# TODO: `inspect`.
# @return [String]
#
# define_singleton_method(:inspect) { "#{target_class}InstanceProxy" }
define_singleton_method(:inspect) { "#{target_class}::InstanceProxy" }
end

klass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@
end
end

##
# TODO: Specs for autogenerated `#inspect`.
#
describe "#inspect" do
it "returns inspect representation" do
expect(instance_proxy_class.inspect).to eq("#{target_class}::InstanceProxy")
end
end
end
end
end
Expand Down

0 comments on commit 078d219

Please sign in to comment.