trax_core 0.0.81 → 0.0.82

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: b2e6a4cb955ae996c2b8941aebb6e4e80013aa35
4
- data.tar.gz: 50dd9c4f7fe2ca36378c597dc704fdd237a8a4a1
3
+ metadata.gz: 0f1e920cce6d37d61b4a163ff1a38595795b68d1
4
+ data.tar.gz: a9f3bebf1be7bcec987b8c5b146340b2a82a4005
5
5
  SHA512:
6
- metadata.gz: d36c531fe5f70a9fab622b66c09e109a5fa3bb5c9ad0e1566ad14f7e8e2bf5d188a9203902f24c4754f680bc0ed4897436bb7a4491023a275006683d3d175b5b
7
- data.tar.gz: 1600fa9f8511c58cd69c23d90ee17bbd7581eb65cdd5adc1d11bce0d69a73b342371008ecc05358dfd34eedd6a1d8eeff6ae11061ff9eb27ce46645855c7ca0a
6
+ metadata.gz: c595c9cb3ceb58fdbd8b9341a2473a56f56625231878d2a39a0429cd12ebb7c86ff7cce743c0a21ac1f808478d4ff4f361ea66745e84988cd59437e73eeebabd
7
+ data.tar.gz: 9e2a8ba3c40ce20abedb1c913e2bd6b053499982c7fee790ca5d1e638439770d3ca02394910cc308171c97b36e4cc93300ef77686ae8cf300c27397adc00b88a
@@ -37,5 +37,6 @@ module Trax
37
37
  autoload :NamedModule
38
38
  autoload :SilenceWarnings
39
39
  autoload :Types
40
+ autoload :PathPermutations
40
41
  end
41
42
  end
@@ -0,0 +1,24 @@
1
+ module Trax
2
+ module Core
3
+ class PathPermutations < SimpleDelegator
4
+ include ::Enumerable
5
+
6
+ def initialize(*args, current_path_segments:[])
7
+ _current = args.shift
8
+ current_path_segments << [current_path_segments.last, _current].compact
9
+
10
+ @paths = if args.length > 0
11
+ self.class.new(*args, current_path_segments: current_path_segments)
12
+ else
13
+ current_path_segments.map!{ |segs| segs.join("/") }
14
+ end
15
+
16
+ @paths
17
+ end
18
+
19
+ def __getobj__
20
+ @paths
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module TraxCore
2
- VERSION = "0.0.81"
2
+ VERSION = "0.0.82"
3
3
  end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe ::Trax::Core::PathPermutations do
4
+ let(:test_path_args) { ["a", "b", "c", "d"]}
5
+ let(:expected_result) { ["a", "a/b", "a/b/c", "a/b/c/d"] }
6
+ subject { described_class.new(*test_path_args) }
7
+
8
+ it { expect(subject.length).to eq 4 }
9
+ it { expect(subject).to eq expected_result }
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trax_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.81
4
+ version: 0.0.82
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Ayre
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -210,6 +210,7 @@ files:
210
210
  - lib/trax/core/mixin.rb
211
211
  - lib/trax/core/named_class.rb
212
212
  - lib/trax/core/named_module.rb
213
+ - lib/trax/core/path_permutations.rb
213
214
  - lib/trax/core/primitives/enum.rb
214
215
  - lib/trax/core/primitives/enum_value.rb
215
216
  - lib/trax/core/silence_warnings.rb
@@ -258,6 +259,7 @@ files:
258
259
  - spec/trax/core/inheritance_spec.rb
259
260
  - spec/trax/core/named_class_spec.rb
260
261
  - spec/trax/core/named_module_spec.rb
262
+ - spec/trax/core/path_permutations_spec.rb
261
263
  - spec/trax/core/types/array_spec.rb
262
264
  - spec/trax/core/types/enum_spec.rb
263
265
  - spec/trax/core/types/struct_spec.rb
@@ -319,6 +321,7 @@ test_files:
319
321
  - spec/trax/core/inheritance_spec.rb
320
322
  - spec/trax/core/named_class_spec.rb
321
323
  - spec/trax/core/named_module_spec.rb
324
+ - spec/trax/core/path_permutations_spec.rb
322
325
  - spec/trax/core/types/array_spec.rb
323
326
  - spec/trax/core/types/enum_spec.rb
324
327
  - spec/trax/core/types/struct_spec.rb