Class: Font

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(font_family:, font_postscript_name:, font_size:, font_weight:, letter_spacing:) ⇒ Font

Returns a new instance of Font.



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

def initialize(
  font_family:,
  font_postscript_name:,
  font_size:,
  font_weight:,
  letter_spacing:
)
  @font_family = font_family
  @font_postscript_name = font_postscript_name
  @font_size = font_size
  @font_weight = font_weight
  @letter_spacing = letter_spacing
end

Instance Attribute Details

#font_familyObject

Returns the value of attribute font_family.



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

def font_family
  @font_family
end

#font_postscript_nameObject

Returns the value of attribute font_postscript_name.



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

def font_postscript_name
  @font_postscript_name
end

#font_sizeObject

Returns the value of attribute font_size.



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

def font_size
  @font_size
end

#font_weightObject

Returns the value of attribute font_weight.



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

def font_weight
  @font_weight
end

#letter_spacingObject

Returns the value of attribute letter_spacing.



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

def letter_spacing
  @letter_spacing
end

Class Method Details

.from_hash(hash) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/domain/primitives/font.rb', line 25

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

  font_family = hash['font_family']
  font_postscript_name = hash['font_postscript_name']
  font_size = hash['font_size']
  font_weight = hash['font_weight']
  letter_spacing = hash['letter_spacing']

  if !font_family.nil? && !font_postscript_name.nil? && !font_size.nil? && !font_weight.nil? && !letter_spacing.nil?
    return Font.new(
      font_family: font_family,
      font_postscript_name: font_postscript_name,
      font_size: font_size,
      font_weight: font_weight,
      letter_spacing: letter_spacing
    )
  end

  nil
end

Instance Method Details

#to_hashObject



47
48
49
50
51
52
53
54
55
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/domain/primitives/font.rb', line 47

def to_hash
  hash = {}
  hash['font_family'] = font_family
  hash['font_postscript_name'] = font_postscript_name
  hash['font_size'] = font_size
  hash['font_weight'] = font_weight
  hash['letter_spacing'] = letter_spacing
  hash
end