lib/vedeu/colours/colour.rb in vedeu-0.8.3 vs lib/vedeu/colours/colour.rb in vedeu-0.8.4
- old
+ new
@@ -72,19 +72,19 @@
}
end
# @return [Vedeu::Colours::Background]
def background
- @_background ||= Vedeu::Colours::Background.coerce(@background)
+ Vedeu::Colours::Background.coerce(@background)
end
# Converts the value into a Vedeu::Colours::Background.
#
# @param value [String]
# @return [Vedeu::Colours::Foreground]
def background=(value)
- @_background = @background = Vedeu::Colours::Background.coerce(value)
+ @background = Vedeu::Colours::Background.coerce(value)
end
# An object is equal when its values are the same.
#
# @param other [void]
@@ -95,18 +95,25 @@
end
alias_method :==, :eql?
# @return [Vedeu::Colours::Foreground]
def foreground
- @_foreground ||= Vedeu::Colours::Foreground.coerce(@foreground)
+ Vedeu::Colours::Foreground.coerce(@foreground)
end
# Converts the value into a Vedeu::Colours::Foreground.
#
# @param value [String]
# @return [Vedeu::Colours::Foreground]
def foreground=(value)
- @_foreground = @foreground = Vedeu::Colours::Foreground.coerce(value)
+ @foreground = Vedeu::Colours::Foreground.coerce(value)
+ end
+
+ # @return [String]
+ def to_ast
+ [foreground.to_ast, background.to_ast].reject do |value|
+ absent?(value)
+ end.join(' ')
end
# @return [Hash<Symbol => Hash<Symbol => String>>]
def to_h
{