Class: PSD::Resource::Section::LayerComps

Inherits:
Base
  • Object
show all
Defined in:
lib/psd/resources/layer_comps.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, name, #name, #resource_id, resource_id

Constructor Details

This class inherits a constructor from PSD::Resource::Section::Base

Class Method Details

.appearance_captured?(comp) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/psd/resources/layer_comps.rb', line 18

def self.appearance_captured?(comp)
  comp[:captured_info] & 0b100 > 0
end

.position_captured?(comp) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/psd/resources/layer_comps.rb', line 14

def self.position_captured?(comp)
  comp[:captured_info] & 0b010 > 0
end

.visibility_captured?(comp) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/psd/resources/layer_comps.rb', line 10

def self.visibility_captured?(comp)
  comp[:captured_info] & 0b001 > 0
end

Instance Method Details

#[](val) ⇒ Object



34
35
36
# File 'lib/psd/resources/layer_comps.rb', line 34

def [](val)
  @data[val]
end

#namesObject



30
31
32
# File 'lib/psd/resources/layer_comps.rb', line 30

def names
  @data['list'].map { |c| c['Nm  '] }
end

#parseObject



22
23
24
25
26
27
28
# File 'lib/psd/resources/layer_comps.rb', line 22

def parse
  # Descriptor version
  @file.seek 4, IO::SEEK_CUR
  
  @data = Descriptor.new(@file).parse
  @resource.data = self
end

#to_aObject



38
39
40
# File 'lib/psd/resources/layer_comps.rb', line 38

def to_a
  @data['list'].map { |c| {id: c['compID'], name: c['Nm  '], captured_info: c['capturedInfo']} }
end