class Humidifier::Props::ListProp
Attributes
subprop[R]
Public Class Methods
new(key, spec = {}, substructs = {})
click to toggle source
Calls superclass method
Humidifier::Props::Prop::new
# File lib/humidifier/props.rb, line 83 def initialize(key, spec = {}, substructs = {}) super(key, spec) @subprop = Props.singular_from(key, spec, substructs) end
Public Instance Methods
to_cf(list)
click to toggle source
# File lib/humidifier/props.rb, line 88 def to_cf(list) cf_value = if list.respond_to?(:to_cf) list.to_cf else list.map { |value| subprop.to_cf(value).last } end [key, cf_value] end
valid?(list)
click to toggle source
Calls superclass method
Humidifier::Props::Prop#valid?
# File lib/humidifier/props.rb, line 99 def valid?(list) return true if super(list) list.is_a?(Enumerable) && list.all? { |value| subprop.valid?(value) } end