Class: FigmaComponentsStylesMeta

Inherits:
Object
  • Object
show all
Defined in:
lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(styles:, components:) ⇒ FigmaComponentsStylesMeta

Returns a new instance of FigmaComponentsStylesMeta.



9
10
11
12
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb', line 9

def initialize(styles:, components:)
  @styles = styles
  @components = components
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb', line 7

def components
  @components
end

#stylesObject

Returns the value of attribute styles.



7
8
9
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb', line 7

def styles
  @styles
end

Class Method Details

.from_hash(hash) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb', line 14

def self.from_hash(hash)
  styles_hash = hash['styles']
  components_hash = hash['components']

  styles = styles_hash.nil? ? nil : styles_hash.map { |s| FigmaStyle.from_hash(s) }
  components = components_hash.nil? ? nil : components_hash.map { |c| FigmaComponent.from_hash(c) }

  FigmaComponentsStylesMeta.new(styles: styles, components: components)
end

Instance Method Details

#to_hashObject



24
25
26
27
28
29
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_components_styles_meta.rb', line 24

def to_hash
  hash = {}
  hash['styles'] = styles.map(&:to_hash) unless styles.nil?
  hash['components'] = components.map(&:to_hash) unless components.nil?
  hash
end