Skip to content

Commit

Permalink
Fix Style/ClassMethodsDefinitions violations
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshenny committed Apr 26, 2024
1 parent 273ad53 commit 9dfc993
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
12 changes: 7 additions & 5 deletions lib/app_profiler/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ class UnsafeFilename < StandardError; end
delegate :[], to: :@data
attr_reader :id, :context

# This function should not be called if `StackProf.results` returns nil.
def self.from_stackprof(data)
options = INTERNAL_METADATA_KEYS.map { |key| [key, data[:metadata]&.delete(key)] }.to_h
class << self
# This function should not be called if `StackProf.results` returns nil.
def from_stackprof(data)
options = INTERNAL_METADATA_KEYS.map { |key| [key, data[:metadata]&.delete(key)] }.to_h

new(data, **options).tap do |profile|
raise ArgumentError, "invalid profile data" unless profile.valid?
new(data, **options).tap do |profile|
raise ArgumentError, "invalid profile data" unless profile.valid?
end
end
end

Expand Down
12 changes: 7 additions & 5 deletions lib/app_profiler/storage/base_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ class BaseStorage
class_attribute :bucket_name, default: "profiles"
class_attribute :credentials, default: {}

def self.upload(_profile)
raise NotImplementedError
end
class << self
def upload(_profile)
raise NotImplementedError
end

def self.enqueue_upload(_profile)
raise NotImplementedError
def enqueue_upload(_profile)
raise NotImplementedError
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ class Sanitizer < Rails::HTML::Sanitizer.best_supported_vendor.safe_list_sanitiz

private_constant(:Sanitizer)

def self.id(file)
file.basename.to_s.delete_suffix(".json")
class << self
def id(file)
file.basename.to_s.delete_suffix(".json")
end
end

def initialize(app)
Expand Down

0 comments on commit 9dfc993

Please sign in to comment.