Module: Playbook::VerticalAlign
- Included in:
- KitBase
- Defined in:
- lib/playbook/vertical_align.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#vertical_align_options ⇒ Object
rubocop:enable Style/IfInsideElse.
-
#vertical_align_props ⇒ Object
rubocop:disable Style/IfInsideElse.
- #vertical_align_values ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/vertical_align.rb', line 5 def self.included(base) base.prop :vertical_align end |
Instance Method Details
#vertical_align_options ⇒ Object
rubocop:enable Style/IfInsideElse
27 28 29 30 31 |
# File 'lib/playbook/vertical_align.rb', line 27 def { vertical_align: "vertical_align", } end |
#vertical_align_props ⇒ Object
rubocop:disable Style/IfInsideElse
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/playbook/vertical_align.rb', line 10 def vertical_align_props selected_props = .keys.select { |sk| try(sk) } return nil unless selected_props.present? selected_props.map do |k| vertical_align_value = send(k) if vertical_align_value.is_a?(Hash) vertical_align_value.map do |media_size, flex_value| "vertical_align_#{media_size}_#{flex_value.underscore}" if vertical_align_values.include? flex_value end else "vertical_align_#{vertical_align_value.underscore}" if vertical_align_values.include? vertical_align_value end end.compact.join(" ") end |
#vertical_align_values ⇒ Object
33 34 35 |
# File 'lib/playbook/vertical_align.rb', line 33 def vertical_align_values %w[baseline super top middle bottom sub text-top text-bottom] end |