Class: Pastel::ColorResolver Private
- Inherits:
-
Object
- Object
- Pastel::ColorResolver
- Defined in:
- lib/pastel/color_resolver.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Contains logic for resolving styles applied to component
Used internally by Delegator.
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
The color instance.
Instance Method Summary collapse
-
#initialize(color) ⇒ ColorResolver
constructor
private
Initialize ColorResolver.
-
#resolve(base, unprocessed_string) ⇒ Object
private
Resolve uncolored string.
Constructor Details
#initialize(color) ⇒ ColorResolver
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize ColorResolver
21 22 23 |
# File 'lib/pastel/color_resolver.rb', line 21 def initialize(color) @color = color end |
Instance Attribute Details
#color ⇒ Object (readonly)
The color instance
14 15 16 |
# File 'lib/pastel/color_resolver.rb', line 14 def color @color end |
Instance Method Details
#resolve(base, unprocessed_string) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resolve uncolored string
28 29 30 31 32 33 34 |
# File 'lib/pastel/color_resolver.rb', line 28 def resolve(base, unprocessed_string) if base.to_a.last == :detach Detached.new(color, *base.to_a[0...-1]) else color.decorate(unprocessed_string, *base) end end |