Class: Interactify::Wiring::Constants
- Inherits:
-
Object
- Object
- Interactify::Wiring::Constants
- Defined in:
- lib/interactify/wiring/constants.rb
Instance Attribute Summary collapse
-
#interactor_files ⇒ Object
readonly
Returns the value of attribute interactor_files.
-
#organizer_files ⇒ Object
readonly
Returns the value of attribute organizer_files.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root:, organizer_files:, interactor_files:) ⇒ Constants
constructor
A new instance of Constants.
- #interactor_lookup ⇒ Object
- #interactors ⇒ Object
- #organizers ⇒ Object
Constructor Details
#initialize(root:, organizer_files:, interactor_files:) ⇒ Constants
Returns a new instance of Constants.
8 9 10 11 12 |
# File 'lib/interactify/wiring/constants.rb', line 8 def initialize(root:, organizer_files:, interactor_files:) @root = root.is_a?(Pathname) ? root : Pathname.new(root) @organizer_files = organizer_files @interactor_files = interactor_files end |
Instance Attribute Details
#interactor_files ⇒ Object (readonly)
Returns the value of attribute interactor_files.
6 7 8 |
# File 'lib/interactify/wiring/constants.rb', line 6 def interactor_files @interactor_files end |
#organizer_files ⇒ Object (readonly)
Returns the value of attribute organizer_files.
6 7 8 |
# File 'lib/interactify/wiring/constants.rb', line 6 def organizer_files @organizer_files end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/interactify/wiring/constants.rb', line 6 def root @root end |
Instance Method Details
#interactor_lookup ⇒ Object
26 27 28 |
# File 'lib/interactify/wiring/constants.rb', line 26 def interactor_lookup @interactor_lookup ||= (interactors + organizers).index_by(&:klass) end |
#interactors ⇒ Object
20 21 22 23 24 |
# File 'lib/interactify/wiring/constants.rb', line 20 def interactors @interactors ||= interactor_files.flat_map do |f| callables_in_file(f) end.compact.reject(&:organizer?) end |
#organizers ⇒ Object
14 15 16 17 18 |
# File 'lib/interactify/wiring/constants.rb', line 14 def organizers @organizers ||= organizer_files.flat_map do |f| callables_in_file(f) end.compact.select(&:organizer?) end |