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

Instance Method Summary collapse

Methods inherited from LayerInfo

#skip

Constructor Details

#initialize(file, length) ⇒ NestedLayerDivider

Returns a new instance of NestedLayerDivider.



14
15
16
17
18
19
# File 'lib/psd/layer_info/layer_group.rb', line 14

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.



12
13
14
# File 'lib/psd/layer_info/layer_group.rb', line 12

def is_folder
  @is_folder
end

#is_hiddenObject (readonly)

Returns the value of attribute is_hidden.



12
13
14
# File 'lib/psd/layer_info/layer_group.rb', line 12

def is_hidden
  @is_hidden
end

Instance Method Details

#parseObject



21
22
23
24
25
26
27
28
# File 'lib/psd/layer_info/layer_group.rb', line 21

def parse
  code = @file.read_int

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