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

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

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.

Parameters:

  • family: (String, nil) (defaults to: nil)
  • weight: (Symbol, nil) (defaults to: nil)
  • style: (Symbol, nil) (defaults to: nil)
  • stretch: (Symbol, nil) (defaults to: nil)


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) ⇒ Spec

Returns a copy with the given fields updated.

Parameters:

  • changes (Object)

Returns:



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

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