Class: FigmaColor

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(r:, g:, b:, a:) ⇒ FigmaColor

Returns a new instance of FigmaColor.



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

def initialize(r:, g:, b:, a:)
  @r = r
  @g = g
  @b = b
  @a = a
end

Instance Attribute Details

#aObject

Returns the value of attribute a.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_color.rb', line 4

def a
  @a
end

#bObject

Returns the value of attribute b.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_color.rb', line 4

def b
  @b
end

#gObject

Returns the value of attribute g.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_color.rb', line 4

def g
  @g
end

#rObject

Returns the value of attribute r.



4
5
6
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_color.rb', line 4

def r
  @r
end

Class Method Details

.from_hash(hash) ⇒ Object



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

def self.from_hash(hash)
  return nil if hash.nil?

  r = hash['r']
  g = hash['g']
  b = hash['b']
  a = hash['a']

  return FigmaColor.new(r: r, g: g, b: b, a: a) if !r.nil? && !g.nil? && !b.nil? && !a.nil?

  nil
end

Instance Method Details

#to_hashObject



26
27
28
29
30
31
32
33
34
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_color.rb', line 26

def to_hash
  hash = {}
  hash['r'] = r
  hash['g'] = g
  hash['b'] = b
  hash['a'] = a

  hash
end