Skip to content

Commit

Permalink
Rename to clarify meaning
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemanrubia committed Dec 27, 2024
1 parent 7ded7ac commit ced176c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/hotwire/spark/change.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class Hotwire::Spark::Change
attr_reader :paths, :extensions, :changed_path, :action
attr_reader :monitored_paths, :extensions, :changed_path, :action

def initialize(paths, extensions, changed_path, action)
@paths = paths
def initialize(monitored_paths, extensions, changed_path, action)
@monitored_paths = monitored_paths
@extensions = extensions
@changed_path = changed_path
@action = action
Expand All @@ -23,7 +23,7 @@ def reload_message

def canonical_changed_path
canonical_changed_path = changed_path
paths.each { |path| canonical_changed_path = canonical_changed_path.to_s.gsub(/^#{path}/, "") }
monitored_paths.each { |path| canonical_changed_path = canonical_changed_path.to_s.gsub(/^#{path}/, "") }
canonical_changed_path
end

Expand Down
8 changes: 4 additions & 4 deletions lib/hotwire/spark/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def register_monitored_paths
end

def monitor(paths_name, action:, extensions:)
paths = Hotwire::Spark.public_send(paths_name)
if paths.present?
file_watcher.monitor paths do |file_path|
Hotwire::Spark::Change.new(paths, extensions, file_path, action).broadcast
monitored_paths = Hotwire::Spark.public_send(paths_name)
if monitored_paths.present?
file_watcher.monitor monitored_paths do |changed_path|
Hotwire::Spark::Change.new(monitored_paths, extensions, changed_path, action).broadcast
end
end
end
Expand Down

0 comments on commit ced176c

Please sign in to comment.