Sha256: 6fd908d592d29371390bfdc2582092f61083900993933555d193993f467f330c
Contents?: true
Size: 660 Bytes
Versions: 6
Compression:
Stored size: 660 Bytes
Contents
module Slacken::Filters # Public: Change checkbox input node to checkbox node. class StringfyCheckbox < Slacken::Filter def call(component) if checkbox_input?(component) component.class.new(:checkbox, [], checked: component.attrs[:checked]) else component.derive(component.children.map(&method(:call))) end end def valid?(component) if checkbox_input?(component) false else component.children.all?(&method(:valid?)) end end private def checkbox_input?(component) component.type.member_of?(:input) && component.attrs[:type] == 'checkbox' end end end
Version data entries
6 entries across 6 versions & 1 rubygems