Class: FigmaNode
- Inherits:
-
Object
- Object
- FigmaNode
- Defined in:
- lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb
Instance Attribute Summary collapse
-
#fills ⇒ Object
Returns the value of attribute fills.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#style ⇒ Object
Returns the value of attribute style.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, type:, style:, fills:) ⇒ FigmaNode
constructor
A new instance of FigmaNode.
- #to_hash ⇒ Object
Constructor Details
#initialize(id:, name:, type:, style:, fills:) ⇒ FigmaNode
Returns a new instance of FigmaNode.
9 10 11 12 13 14 15 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 9 def initialize(id:, name:, type:, style:, fills:) @id = id @name = name @type = type @style = style @fills = fills end |
Instance Attribute Details
#fills ⇒ Object
Returns the value of attribute fills.
7 8 9 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 7 def fills @fills end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 7 def name @name end |
#style ⇒ Object
Returns the value of attribute style.
7 8 9 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 7 def style @style end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 7 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 17 def self.from_hash(hash) return nil if hash.nil? id = hash['id'] name = hash['name'] type = hash['type'] style_hash = hash['style'] style = style_hash.nil? ? nil : FigmaTypeStyle.from_hash(style_hash) fills = (hash['fills'] || []).map { |f| FigmaPaint.from_hash(f) }.compact || [] if !id.nil? && !name.nil? && !type.nil? return FigmaNode.new(id: id, name: name, type: type, style: style, fills: fills) end nil end |
Instance Method Details
#to_hash ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_node.rb', line 34 def to_hash hash = {} hash['id'] = id hash['name'] = name hash['type'] = type hash['style'] = style.to_hash unless style.nil? hash['fills'] = (fills || []).map(&:to_hash) hash end |