lib/whirled_peas/settings/border.rb in whirled_peas-0.9.1 vs lib/whirled_peas/settings/border.rb in whirled_peas-0.10.0
- old
+ new
@@ -49,12 +49,24 @@
error_message = "Unsupported border style: #{style.inspect}"
raise ArgumentError, error_message
end
end
+ def self.inherit(parent)
+ border = new(parent.theme)
+ border.inherit(parent)
+ border
+ end
+
+ attr_reader :theme
+
attr_writer :left, :top, :right, :bottom, :inner_horiz, :inner_vert
+ def initialize(theme)
+ @theme = theme
+ end
+
def left?
@left == true
end
def top?
@@ -80,22 +92,31 @@
def outer?
left? || top? || right? || bottom?
end
def style
- @style || Styles::DEFAULT
+ @_style || Styles::DEFAULT
end
def style=(val)
- @style = Styles.validate!(val)
+ @_style = Styles.validate!(val)
end
def color=(val)
- @color = TextColor.validate!(val)
+ @_color = TextColor.validate!(val)
end
def color
- @color || TextColor::DEFAULT
+ @_color || theme.border_color
end
+
+ def inherit(parent)
+ @_style = parent._style
+ @_color = parent._color
+ end
+
+ protected
+
+ attr_reader :_style, :_color
end
end
end