Skip to content

Commit 5230ae0

Browse files
committed
minor refactor
1 parent a2ae63d commit 5230ae0

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

lib/generators/rolemodel/optics/icons/icons_generator.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,23 @@ def remove_existing_icon_helper_and_builders
2222
end
2323

2424
def add_view_helper
25-
@chosen_library = options['icon_library']
26-
@chosen_library ||= ask(
27-
'What icon library would you like to add?',
28-
default: SUPPORTED_LIBRARIES.keys.first.to_s,
29-
limited_to: SUPPORTED_LIBRARIES.keys.map(&:to_s)
30-
)
25+
@chosen_library = chosen_icon_library
3126
@supported_properties = SUPPORTED_LIBRARIES.fetch(@chosen_library)
3227

3328
template 'app/icon_builders/icon_builder.rb'
3429
template "app/icon_builders/#{@chosen_library}_icon_builder.rb"
3530
template 'app/helpers/icon_helper.rb'
3631
end
32+
33+
private
34+
35+
def chosen_icon_library
36+
return options['icon_library'] if options.icon_library?
37+
38+
ask('What icon library would you like to add?',
39+
default: SUPPORTED_LIBRARIES.keys.first.to_s,
40+
limited_to: SUPPORTED_LIBRARIES.keys.map(&:to_s))
41+
end
3742
end
3843
end
3944
end

0 commit comments

Comments
 (0)