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 +4 -4
- data/lib/trax/core.rb +1 -0
- data/lib/trax/core/path_permutations.rb +24 -0
- data/lib/trax_core/version.rb +1 -1
- data/spec/trax/core/path_permutations_spec.rb +10 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f1e920cce6d37d61b4a163ff1a38595795b68d1
|
4
|
+
data.tar.gz: a9f3bebf1be7bcec987b8c5b146340b2a82a4005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c595c9cb3ceb58fdbd8b9341a2473a56f56625231878d2a39a0429cd12ebb7c86ff7cce743c0a21ac1f808478d4ff4f361ea66745e84988cd59437e73eeebabd
|
7
|
+
data.tar.gz: 9e2a8ba3c40ce20abedb1c913e2bd6b053499982c7fee790ca5d1e638439770d3ca02394910cc308171c97b36e4cc93300ef77686ae8cf300c27397adc00b88a
|
data/lib/trax/core.rb
CHANGED
@@ -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
|
data/lib/trax_core/version.rb
CHANGED
@@ -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.
|
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-
|
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
|