Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Style/ExplicitBlockArgument offenses #242

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions lib/chrono_model/adapter/indexes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,18 @@ def temporal_index_names(table, range, options = {})
# only on the history table, and the creation methods already
# run scoped into the correct schema.
#
def chrono_alter_index(table_name, options)
def chrono_alter_index(table_name, options, &block)
if is_chrono?(table_name) && !options[:on_current_schema]
on_temporal_schema { yield }
on_history_schema { yield }
on_temporal_schema(&block)
on_history_schema(&block)
else
yield
end
end

def chrono_alter_constraint(table_name, options)
def chrono_alter_constraint(table_name, options, &block)
if is_chrono?(table_name) && !options[:on_current_schema]
on_temporal_schema { yield }
on_temporal_schema(&block)
else
yield
end
Expand Down
4 changes: 2 additions & 2 deletions lib/chrono_model/adapter/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ def remove_column(table_name, column_name, type = nil, **options)
# types, the view must be dropped and recreated, while the change has
# to be applied to the table in the temporal schema.
#
def drop_and_recreate_public_view(table_name, opts = {})
def drop_and_recreate_public_view(table_name, opts = {}, &block)
transaction do
options = chrono_metadata_for(table_name).merge(opts)

execute "DROP VIEW #{table_name}"

on_temporal_schema { yield }
on_temporal_schema(&block)

# Recreate the triggers
chrono_public_view_ddl(table_name, options)
Expand Down
4 changes: 2 additions & 2 deletions lib/chrono_model/time_machine/history_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,11 @@ def read_attribute(attr_name, &block)

private

def with_hid_pkey
def with_hid_pkey(&block)
old_primary_key = @primary_key
@primary_key = :hid

self.class.with_hid_pkey { yield }
self.class.with_hid_pkey(&block)
ensure
@primary_key = old_primary_key
end
Expand Down