Class: Plushie::Type::Font::Spec

Inherits:
Data
  • Object
show all
Defined in:
lib/plushie/type/font.rb

Overview

Immutable spec; use #with to create modified copies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(family: nil, weight: nil, style: nil, stretch: nil) ⇒ Spec

Returns a new instance of Spec.



30
31
32
# File 'lib/plushie/type/font.rb', line 30

def initialize(family: nil, weight: nil, style: nil, stretch: nil)
  super
end

Instance Attribute Details

#familyObject (readonly)

Returns the value of attribute family

Returns:

  • (Object)

    the current value of family



29
30
31
# File 'lib/plushie/type/font.rb', line 29

def family
  @family
end

#stretchObject (readonly)

Returns the value of attribute stretch

Returns:

  • (Object)

    the current value of stretch



29
30
31
# File 'lib/plushie/type/font.rb', line 29

def stretch
  @stretch
end

#styleObject (readonly)

Returns the value of attribute style

Returns:

  • (Object)

    the current value of style



29
30
31
# File 'lib/plushie/type/font.rb', line 29

def style
  @style
end

#weightObject (readonly)

Returns the value of attribute weight

Returns:

  • (Object)

    the current value of weight



29
30
31
# File 'lib/plushie/type/font.rb', line 29

def weight
  @weight
end

Instance Method Details

#with(**changes) ⇒ Object

Returns a copy with the given fields updated.



35
36
37
# File 'lib/plushie/type/font.rb', line 35

def with(**changes)
  self.class.new(**to_h.merge(changes))
end