From f5db916077cda4742f6ba3262213669f1e789b25 Mon Sep 17 00:00:00 2001 From: Abdelkader Boudih Date: Fri, 19 Jan 2024 03:13:48 +0100 Subject: [PATCH] feat: use new concern syntax --- lib/closure_tree/digraphs.rb | 2 +- lib/closure_tree/finders.rb | 2 +- lib/closure_tree/hash_tree.rb | 2 +- lib/closure_tree/hierarchy_maintenance.rb | 2 +- lib/closure_tree/numeric_deterministic_ordering.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/closure_tree/digraphs.rb b/lib/closure_tree/digraphs.rb index 19adc214..241d6373 100644 --- a/lib/closure_tree/digraphs.rb +++ b/lib/closure_tree/digraphs.rb @@ -11,7 +11,7 @@ def to_digraph_label _ct.has_name? ? read_attribute(_ct.name_column) : to_s end - module ClassMethods + class_methods do # Renders the given scope as a DOT digraph, suitable for rendering by Graphviz def to_dot_digraph(tree_scope) id_to_instance = tree_scope.reduce({}) { |h, ea| h[ea.id] = ea; h } diff --git a/lib/closure_tree/finders.rb b/lib/closure_tree/finders.rb index c95b5c12..813c06bc 100644 --- a/lib/closure_tree/finders.rb +++ b/lib/closure_tree/finders.rb @@ -50,7 +50,7 @@ def without_self(scope) scope.without_instance(self) end - module ClassMethods + class_methods do def without_instance(instance) if instance.new_record? diff --git a/lib/closure_tree/hash_tree.rb b/lib/closure_tree/hash_tree.rb index 7cf4fbe8..f8be73b5 100644 --- a/lib/closure_tree/hash_tree.rb +++ b/lib/closure_tree/hash_tree.rb @@ -6,7 +6,7 @@ def hash_tree(options = {}) _ct.hash_tree(self_and_descendants, options[:limit_depth]) end - module ClassMethods + class_methods do # There is no default depth limit. This might be crazy-big, depending # on your tree shape. Hash huge trees at your own peril! diff --git a/lib/closure_tree/hierarchy_maintenance.rb b/lib/closure_tree/hierarchy_maintenance.rb index f7c5492d..ab8ce849 100644 --- a/lib/closure_tree/hierarchy_maintenance.rb +++ b/lib/closure_tree/hierarchy_maintenance.rb @@ -104,7 +104,7 @@ def delete_hierarchy_references end end - module ClassMethods + class_methods do # Rebuilds the hierarchy table based on the parent_id column in the database. # Note that the hierarchy table will be truncated. def rebuild! diff --git a/lib/closure_tree/numeric_deterministic_ordering.rb b/lib/closure_tree/numeric_deterministic_ordering.rb index 663b57b6..4afe5785 100644 --- a/lib/closure_tree/numeric_deterministic_ordering.rb +++ b/lib/closure_tree/numeric_deterministic_ordering.rb @@ -42,7 +42,7 @@ def self_and_descendants_preordered .reorder(self.class._ct_sum_order_by(self)) end - module ClassMethods + class_methods do # If node is nil, order the whole tree. def _ct_sum_order_by(node = nil)