flame 4.0.10 → 4.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be14da9200fed3ac85396734b7a7922b0d3b656f
4
- data.tar.gz: 722b7fb4e367d44480df72e3d06a885b18c406ee
3
+ metadata.gz: dbccb14cbd979084bd968f1d33e5a5c14fd3cf85
4
+ data.tar.gz: 88da7f91e9123ba41ea353f2b67f7fc47893a55a
5
5
  SHA512:
6
- metadata.gz: 90d68783b528231e9ff24c6c1e754b8f8910651cb3c7dc750b09a08f112d960449332dc314d788c77329f7e30975e9ab713e7718efe97b337d9bec32121c28fc
7
- data.tar.gz: 7ffd1f069de71b3484a3b04c9331b48f94d42e0917aeb9f01fb412757a3aa578566cbcf1dd7a1a930f3fead6bd0385b72e026481443b6fdb6582c430f5c5e386
6
+ metadata.gz: 6d0dfedd16b139980f3acaa814f0a5971c8da0da3e71970ba4647a5240ddeeafb010ef694b7ec9d40247d553e47920f23890c9dcc90a0154729e435d8bad3945
7
+ data.tar.gz: e225d6ba5881aae2fbb6884edc444f8afa6fdd6b9f7722058e8a0c82d5a69ef6390d396068fd3d4273dc63bf7f76e315e1bda92ba7f96be20258a9ca87f129ee
@@ -71,12 +71,25 @@ module Flame
71
71
 
72
72
  ## Find possible directories for the controller
73
73
  def controller_dirs
74
- controller_dir_parts = @ctrl.class.underscore.split('/').map do |part|
75
- (part.split('_') - %w(index controller controllers ctrl)).join('_')
74
+ parts = @ctrl.class.underscore.split('/').map do |part|
75
+ (part.split('_') - %w(controller controllers ctrl)).join('_')
76
76
  end
77
- controller_dir_parts.map.with_index do |_part, ind|
78
- controller_dir_parts[ind..-1].join('/')
77
+ combine_parts(parts).map! { |path| path.join('/') }
78
+ end
79
+
80
+ ## Make combinations in order with different sizes
81
+ ## @example Make parts for ['project', 'namespace', 'controller']
82
+ ## # => [
83
+ ## ['project', 'namespace', 'controller'],
84
+ ## ['project', 'namespace'],
85
+ ## ['namespace', 'controller'],
86
+ ## ['namespace']
87
+ ## ]
88
+ def combine_parts(parts)
89
+ variants = parts.size.times.with_object([]) do |i, arr|
90
+ arr.push parts[i..-1], parts[0..-(i + 1)], parts[i..-(i + 1)]
79
91
  end
92
+ variants.uniq!.reject!(&:empty?)
80
93
  end
81
94
 
82
95
  def layout_dirs
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Flame
4
- VERSION = '4.0.10'.freeze
4
+ VERSION = '4.0.11'.freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flame
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.10
4
+ version: 4.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Popov