Class: Wallaby::PrefixesBuilder

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/services/wallaby/prefixes_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controller_classString

Returns:

  • (String)


21
22
23
# File 'lib/services/wallaby/prefixes_builder.rb', line 21

def controller_class
  @controller_class
end

#prefixesArray<String>

Returns:

  • (Array<String>)


12
13
14
# File 'lib/services/wallaby/prefixes_builder.rb', line 12

def prefixes
  @prefixes
end

#resources_nameString?

Returns:

  • (String, nil)


15
16
17
# File 'lib/services/wallaby/prefixes_builder.rb', line 15

def resources_name
  @resources_name
end

#script_nameString

Returns:

  • (String)


18
19
20
# File 'lib/services/wallaby/prefixes_builder.rb', line 18

def script_name
  @script_name
end

Instance Method Details

#executeArray<String>

To extend prefixes to be able to look up the directory even if the custom controller doesn’t not exist

Returns:

  • (Array<String>)

    modified prefixes



26
27
28
29
30
31
32
33
34
# File 'lib/services/wallaby/prefixes_builder.rb', line 26

def execute
  return prefixes_dup unless resourceful?
  return prefixes_dup if possible_resources_path == controller_path

  prefixes_dup.insert(
    prefixes_dup.index(controller_path) + offset,
    possible_resources_path
  )
end