Skip to content

Commit

Permalink
chore: Run lint -A
Browse files Browse the repository at this point in the history
  • Loading branch information
ribose-jeffreylau committed Oct 17, 2024
1 parent 21dc1ca commit 25489d6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
24 changes: 12 additions & 12 deletions lib/paneron/register/register.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Paneron
module Register
class Register
attr_reader :register_path, :register_root_path, :register_yaml_path,
:register_name
:register_name

def initialize(register_root_path, register_name)
register_path = File.join(register_root_path, register_name)
Expand All @@ -13,7 +13,7 @@ def initialize(register_root_path, register_name)
@register_root_path = register_root_path
@register_path = register_path
@register_yaml_path = File.join(register_path,
REGISTER_METADATA_FILENAME)
REGISTER_METADATA_FILENAME)
@item_classes = {}
@item_class_names = nil
@item_uuids = nil
Expand All @@ -24,17 +24,17 @@ def initialize(register_root_path, register_name)
def self.validate_register_path(register_path)
unless File.exist?(register_path)
raise Paneron::Register::Error,
"Register path does not exist"
"Register path does not exist"
end
unless File.directory?(register_path)
raise Paneron::Register::Error,
"Register path is not a directory"
"Register path is not a directory"
end
unless File.exist?(File.join(
register_path, REGISTER_METADATA_FILENAME
))
register_path, REGISTER_METADATA_FILENAME
))
raise Paneron::Register::Error,
"Register metadata file does not exist"
"Register metadata file does not exist"
end
end

Expand All @@ -46,16 +46,16 @@ def item_classes(item_class_name = nil)
end
else
@item_classes[item_class_name] ||=
Paneron::Register::ItemClass.new(
register_root_path, register_name, item_class_name
)
Paneron::Register::ItemClass.new(
register_root_path, register_name, item_class_name
)
end
end

def item_class_names
@item_class_names ||=
Dir.glob(File.join(register_path, "*/*.yaml"))
.map { |file| File.basename(File.dirname(file)) }.uniq
Dir.glob(File.join(register_path, "*/*.yaml"))
.map { |file| File.basename(File.dirname(file)) }.uniq
end

def item_uuids
Expand Down
16 changes: 8 additions & 8 deletions lib/paneron/register/register_root.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def initialize(register_root_path)
self.class.validate_root_path(register_root_path)
@register_root_path = register_root_path
@register_root_yaml_path = File.join(register_root_path,
REGISTER_ROOT_METADATA_FILENAME)
REGISTER_ROOT_METADATA_FILENAME)
@register_names = nil
@registries = {}
end
Expand All @@ -19,17 +19,17 @@ def initialize(register_root_path)
def self.validate_root_path(register_root_path)
unless File.exist?(register_root_path)
raise Paneron::Register::Error,
"Register root path does not exist"
"Register root path does not exist"
end
unless File.directory?(register_root_path)
raise Paneron::Register::Error,
"Register root path is not a directory"
"Register root path is not a directory"
end
unless File.exist?(File.join(
register_root_path, REGISTER_ROOT_METADATA_FILENAME
))
register_root_path, REGISTER_ROOT_METADATA_FILENAME
))
raise Paneron::Register::Error,
"Register root metadata file does not exist"
"Register root metadata file does not exist"
end
end

Expand Down Expand Up @@ -61,8 +61,8 @@ def registries(register_name = nil)
end
else
@registries[register_name] ||=
Paneron::Register::Register.new(register_root_path,
register_name)
Paneron::Register::Register.new(register_root_path,
register_name)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/item_class_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RSpec.describe Paneron::Register::ItemClass do
let(:item_class) do
Paneron::Register::ItemClass.new("spec/fixtures/test-register", "reg-1",
"item-class-1")
"item-class-1")
end

it "lists out item UUIDs" do
Expand Down

0 comments on commit 25489d6

Please sign in to comment.