Class: Wallaby::PrefixesBuilder
- Inherits:
-
Object
- Object
- Wallaby::PrefixesBuilder
- Defined in:
- lib/services/wallaby/prefixes_builder.rb
Overview
Prefix builder
Instance Method Summary collapse
-
#build ⇒ Array<String>
A list of all the prefixes.
-
#initialize(origin_prefixes, controller_path, resources_name, params) ⇒ PrefixesBuilder
constructor
A new instance of PrefixesBuilder.
Constructor Details
#initialize(origin_prefixes, controller_path, resources_name, params) ⇒ PrefixesBuilder
9 10 11 12 13 14 |
# File 'lib/services/wallaby/prefixes_builder.rb', line 9 def initialize(origin_prefixes, controller_path, resources_name, params) @origin_prefixes = origin_prefixes @controller_path = controller_path @resources_name = resources_name @params = params end |
Instance Method Details
#build ⇒ Array<String>
17 18 19 20 21 22 23 24 |
# File 'lib/services/wallaby/prefixes_builder.rb', line 17 def build prefixes = minimal_prefixes prefixes.unshift mounted_prefix if resource_path != @controller_path suffix = build_suffix(@params) prefixes.each_with_object([]) do |prefix, result| result << "#{prefix}/#{suffix}" << prefix if prefix end end |