Class: Styles::Properties::Padding
- Defined in:
- lib/styles/properties/padding.rb
Instance Attribute Summary collapse
-
#bottom ⇒ Object
readonly
Returns the value of attribute bottom.
-
#left ⇒ Object
readonly
Returns the value of attribute left.
-
#right ⇒ Object
readonly
Returns the value of attribute right.
-
#top ⇒ Object
readonly
Returns the value of attribute top.
Attributes inherited from Base
Instance Method Summary collapse
- #all_padding ⇒ Object
-
#initialize(*args) ⇒ Padding
constructor
A new instance of Padding.
Methods inherited from Base
#colors, multiple_names?, names, other_names, sub_engine, sub_engines, to_sym
Constructor Details
#initialize(*args) ⇒ Padding
Returns a new instance of Padding.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/styles/properties/padding.rb', line 9 def initialize(*args) if args.size == 1 && args.first.is_a?(Array) @name = :padding @sub_properties = args.first else if (val = args[2]).is_a?(String) @name = :padding @sub_properties = [] side_values = args[2].split.map(&:to_i) %w[top right bottom left].each_with_index do |side, idx| side_value = side_values[idx] if side_value @sub_properties << self.class.new(args[0], "padding_#{side}".to_sym, side_value) end end else super @sub_properties = nil end end compute_all_padding end |
Instance Attribute Details
#bottom ⇒ Object (readonly)
Returns the value of attribute bottom.
7 8 9 |
# File 'lib/styles/properties/padding.rb', line 7 def bottom @bottom end |
#left ⇒ Object (readonly)
Returns the value of attribute left.
7 8 9 |
# File 'lib/styles/properties/padding.rb', line 7 def left @left end |
#right ⇒ Object (readonly)
Returns the value of attribute right.
7 8 9 |
# File 'lib/styles/properties/padding.rb', line 7 def right @right end |
#top ⇒ Object (readonly)
Returns the value of attribute top.
7 8 9 |
# File 'lib/styles/properties/padding.rb', line 7 def top @top end |
Instance Method Details
#all_padding ⇒ Object
32 33 34 |
# File 'lib/styles/properties/padding.rb', line 32 def all_padding [top, right, bottom, left] end |