Class: AstroSubframeOrganizer::EquipmentSelector
- Inherits:
-
Object
- Object
- AstroSubframeOrganizer::EquipmentSelector
- Defined in:
- lib/astro_subframe_organizer/equipment_selector.rb
Overview
Handles interactive selection of equipment based on configuration and FITS header detection.
Instance Attribute Summary collapse
-
#camera ⇒ Object
Returns the value of attribute camera.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#telescope ⇒ Object
Returns the value of attribute telescope.
Instance Method Summary collapse
- #choose_camera(index = nil) ⇒ Object
- #choose_camera_or_confirm(detected:) ⇒ Object
- #choose_filter(index = nil) ⇒ Object
- #choose_filter_or_confirm(detected:) ⇒ Object
- #choose_telescope(index = nil) ⇒ Object
- #choose_telescope_or_confirm(detected:) ⇒ Object
-
#initialize(prompt = AstroSubframeOrganizer.prompt, telescopes: Telescope.all, cameras: Camera.all, filters: Filter.all) ⇒ EquipmentSelector
constructor
A new instance of EquipmentSelector.
Methods included from Logging
Constructor Details
#initialize(prompt = AstroSubframeOrganizer.prompt, telescopes: Telescope.all, cameras: Camera.all, filters: Filter.all) ⇒ EquipmentSelector
Returns a new instance of EquipmentSelector.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 11 def initialize( prompt = AstroSubframeOrganizer.prompt, telescopes: Telescope.all, cameras: Camera.all, filters: Filter.all ) @telescopes = telescopes @cameras = cameras @filters = filters @prompt = prompt end |
Instance Attribute Details
#camera ⇒ Object
Returns the value of attribute camera.
9 10 11 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 9 def camera @camera end |
#filter ⇒ Object
Returns the value of attribute filter.
9 10 11 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 9 def filter @filter end |
#telescope ⇒ Object
Returns the value of attribute telescope.
9 10 11 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 9 def telescope @telescope end |
Instance Method Details
#choose_camera(index = nil) ⇒ Object
40 41 42 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 40 def choose_camera(index = nil) generic_choose(camera, @cameras, 'camera', index) end |
#choose_camera_or_confirm(detected:) ⇒ Object
44 45 46 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 44 def choose_camera_or_confirm(detected:) generic_choose_or_confirm(camera, @cameras, 'camera', 'INSTRUME', detected) end |
#choose_filter(index = nil) ⇒ Object
48 49 50 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 48 def choose_filter(index = nil) generic_choose(filter, @filters, 'filter', index) end |
#choose_filter_or_confirm(detected:) ⇒ Object
52 53 54 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 52 def choose_filter_or_confirm(detected:) generic_choose_or_confirm(filter, @filters, 'filter', 'FILTER', detected) end |
#choose_telescope(index = nil) ⇒ Object
23 24 25 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 23 def choose_telescope(index = nil) generic_choose(telescope, @telescopes, 'telescope', index, 'What telescope is this set for?') end |
#choose_telescope_or_confirm(detected:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/astro_subframe_organizer/equipment_selector.rb', line 27 def choose_telescope_or_confirm(detected:) if detected && Config.telescope_ignore_patterns.any? { |p| detected.match?(p) } logger.info "Ignoring detected mount name: '#{detected}'" detected = nil end if detected suggestion = "If '#{detected}' is a mount name, consider adding it to 'telescope_ignore_patterns' " \ 'in your config.' end generic_choose_or_confirm(telescope, @telescopes, 'telescope', 'TELESCOP', detected, suggestion: suggestion) end |