Module: Playbook::JustifySelf
- Included in:
- KitBase
- Defined in:
- lib/playbook/justify_self.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#justify_self_options ⇒ Object
rubocop:enable Style/IfInsideElse.
-
#justify_self_props ⇒ Object
rubocop:disable Style/IfInsideElse.
- #justify_self_values ⇒ Object
Class Method Details
.included(base) ⇒ Object
5 6 7 |
# File 'lib/playbook/justify_self.rb', line 5 def self.included(base) base.prop :justify_self end |
Instance Method Details
#justify_self_options ⇒ Object
rubocop:enable Style/IfInsideElse
27 28 29 30 31 |
# File 'lib/playbook/justify_self.rb', line 27 def { justify_self: "justify_self", } end |
#justify_self_props ⇒ Object
rubocop:disable Style/IfInsideElse
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/playbook/justify_self.rb', line 10 def justify_self_props selected_props = .keys.select { |sk| try(sk) } return nil unless selected_props.present? selected_props.map do |k| justify_self_value = send(k) if justify_self_value.is_a?(Hash) justify_self_value.map do |media_size, self_value| "justify_self_#{media_size}_#{self_value}" if justify_self_values.include? self_value end else "justify_self_#{justify_self_value}" if justify_self_values.include? justify_self_value end end.compact.join(" ") end |
#justify_self_values ⇒ Object
33 34 35 |
# File 'lib/playbook/justify_self.rb', line 33 def justify_self_values %w[auto start end center stretch] end |