psd 1.1.0 → 1.1.1

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: 93b149110f6660cd6b6231f8e8e1bcf440ffac4c
4
- data.tar.gz: 7762bab9c1c6504a5fd39f54602acd27e30746ee
3
+ metadata.gz: 2bc299dfcc8a9b41a3f17b16a204c2894668b5cc
4
+ data.tar.gz: bf991e614ddb7f6e151c42d6bcc627e7d34a1050
5
5
  SHA512:
6
- metadata.gz: d198525b3c71df4b3c4d869a3d56752f709bde1ccda35f25c22b4da0d68775bbe7ed09adfdb013fce65600953a4a421eb618430a613017c16c93aa404887ff19
7
- data.tar.gz: 90ba4242c94d7cb725ed2180188cee87ba2230a2cc45bd77ed33bf6e2e7046561efabd6c9293847343e55fa13d7efba9e4b7491e004c100a3c8c32ab304ee51f
6
+ metadata.gz: 96f2cbfb412549b89d2c4dc0bfa579c31c1c92e3451b0bf498adcbffafcdff48024ddc68625fc2db0c01910f22e195839efaaf84bdb137187bfc6d09411fa8e2
7
+ data.tar.gz: aaabac77598af888c915cc9e600c9ac393f7aff6cd1a3ea3e987a7186d7d698204669040f3f5eb2eb476fb1dbc408a148b18459736d721681536d667cff577ab
@@ -50,7 +50,7 @@ class PSD
50
50
 
51
51
  # Recursively get all descendant nodes, not including this node.
52
52
  def descendants
53
- children + children.map(&:children).flatten
53
+ children.map(&:subtree).flatten
54
54
  end
55
55
 
56
56
  # Same as descendants, except it includes this node.
@@ -63,6 +63,10 @@ class PSD
63
63
  return ancestors.length + 1
64
64
  end
65
65
 
66
+ def path
67
+ (ancestors.map(&:name) + [name]).join('/')
68
+ end
69
+
66
70
  def method_missing(method, *args, &block)
67
71
  test = /^(.+)_(layers|groups)$/.match(method)
68
72
  if test
data/lib/psd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class PSD
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -66,6 +66,11 @@ describe "Hierarchy" do
66
66
  expect(@tree.children.first.depth).to eq(1)
67
67
  end
68
68
 
69
+ it "should be able to generate a path to a node" do
70
+ node = @tree.children_at_path('Version A/Matte').first
71
+ expect(node.path).to eq('Version A/Matte')
72
+ end
73
+
69
74
  describe "Searching" do
70
75
  it "should find a node given a path" do
71
76
  expect(@tree.children_at_path('Version A/Matte')).to be_an_instance_of(Array)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan LeFevre