Skip to content

Commit

Permalink
Remove Collection#command_options.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepingkingstudios committed Sep 9, 2024
1 parent 634b9ea commit 370c960
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 19 deletions.
4 changes: 2 additions & 2 deletions lib/cuprum/collections/basic/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def query

protected

def command_options
super.merge(
def comparable_options
@comparable_options ||= super.merge(
data:,
default_contract:
)
Expand Down
21 changes: 7 additions & 14 deletions lib/cuprum/collections/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,27 +115,20 @@ def with_scope(other_scope)
attr_writer :scope

def comparable_options
command_options.merge(
name:,
qualified_name:,
scope:,
singular_name:
)
end

private

def command_options
@command_options ||= {
collection_name: name,
@comparable_options ||= {
entity_class:,
member_name: singular_name,
name:,
primary_key_name:,
primary_key_type:,
qualified_name:,
scope:,
singular_name:,
**options
}
end

private

def default_scope
Cuprum::Collections::Scopes::AllScope.new
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def tools
end

describe 'with matching name' do
let(:other_options) { { collection_name: name } }
let(:other_options) { { name: } }

it { expect(collection.matches?(**other_options)).to be true }
end
Expand Down Expand Up @@ -293,7 +293,7 @@ def tools
describe 'with multiple matching options' do
let(:other_options) do
{
collection_name: name,
name:,
primary_key_name: 'id',
qualified_name: name
}
Expand Down
1 change: 0 additions & 1 deletion spec/cuprum/collections/basic/collection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
end

include_contract 'should be a collection',
command_options: %i[data default_contract],
commands_namespace: 'Cuprum::Collections::Basic::Commands',
default_entity_class: Hash

Expand Down

0 comments on commit 370c960

Please sign in to comment.