Skip to content

Commit

Permalink
PR review adjustments on configuration code
Browse files Browse the repository at this point in the history
  • Loading branch information
khamusa committed Jan 21, 2025
1 parent c34cda3 commit 0ef0a71
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/tabasco/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,23 @@ def initialize(configuration)
# # And you can provide concrete subclass of Tabasco::Section class
# config.portal(:datepicker, MyDatepicker)
# end
def portal(portal_name, klass = nil, test_id: nil)
portal_name = portal_name.to_sym
test_id ||= portal_name
def portal(name, klass = nil, test_id: nil)
name = name.to_sym
test_id ||= name

portals = configuration.instance_variable_get(:@portals)

if portals.key?(portal_name.to_sym)
if portals.key?(name)
raise PortalAlreadyConfiguredError,
"The portal #{portal_name.inspect} is already defined"
"The portal #{name.inspect} is already defined"
end

portals[portal_name] = {klass:, test_id:}
portals[name] = {klass:, test_id:}

nil
end

private

def portals = configuration.instance_variable_get(:@portals)
end
end
end

0 comments on commit 0ef0a71

Please sign in to comment.