Class: PSD::NestedLayerDivider

Inherits:
LayerInfo show all
Defined in:
lib/psd/layer/info/layer_group.rb

Overview

Not 100% sure what the purpose of this key is, but it seems to exist whenever the lsct key doesn’t. Parsing this like a layer section divider seems to solve a lot of parsing issues with folders.

See github.com/layervault/psd.rb/issues/38

Instance Attribute Summary collapse

Attributes inherited from LayerInfo

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LayerInfo

#skip

Constructor Details

#initialize(file, length) ⇒ NestedLayerDivider

Returns a new instance of NestedLayerDivider.



16
17
18
19
20
21
# File 'lib/psd/layer/info/layer_group.rb', line 16

def initialize(file, length)
  super

  @is_folder = false
  @is_hidden = false
end

Instance Attribute Details

#is_folderObject (readonly)

Returns the value of attribute is_folder.



14
15
16
# File 'lib/psd/layer/info/layer_group.rb', line 14

def is_folder
  @is_folder
end

#is_hiddenObject (readonly)

Returns the value of attribute is_hidden.



14
15
16
# File 'lib/psd/layer/info/layer_group.rb', line 14

def is_hidden
  @is_hidden
end

Class Method Details

.should_parse?(key) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/psd/layer/info/layer_group.rb', line 10

def self.should_parse?(key)
  key == 'lsdk'
end

Instance Method Details

#parseObject



23
24
25
26
27
28
29
30
# File 'lib/psd/layer/info/layer_group.rb', line 23

def parse
  code = @file.read_int

  case code
  when 1, 2 then @is_folder = true
  when 3 then @is_hidden = true
  end
end