Class: FigmaPaint
- Inherits:
-
Object
- Object
- FigmaPaint
- Defined in:
- lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#opacity ⇒ Object
Returns the value of attribute opacity.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type:, color:, opacity:) ⇒ FigmaPaint
constructor
A new instance of FigmaPaint.
- #to_hash ⇒ Object
Constructor Details
#initialize(type:, color:, opacity:) ⇒ FigmaPaint
Returns a new instance of FigmaPaint.
8 9 10 11 12 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 8 def initialize(type:, color:, opacity:) @type = type @color = color @opacity = opacity end |
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
6 7 8 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 6 def color @color end |
#opacity ⇒ Object
Returns the value of attribute opacity.
6 7 8 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 6 def opacity @opacity end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 6 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 14 def self.from_hash(hash) return nil if hash.nil? type = hash['type'] color = FigmaColor.from_hash(hash['color']) opacity = hash['opacity'] || 1.0 return FigmaPaint.new(type: type, color: color, opacity: opacity) if !type.nil? && !color.nil? nil end |
Instance Method Details
#to_hash ⇒ Object
26 27 28 29 30 31 |
# File 'lib/admiral-tools-figma/helper/figma/figma_client/models/api/primitives/figma_paint.rb', line 26 def to_hash hash = {} hash['type'] = type hash['color'] = color.to_hash unless color.nil? hash end |