Sha256: b33afb9584b76cc7d4451b80b88f6e1170f688d86757ceabfb4520020cd39e8b

Contents?: true

Size: 326 Bytes

Versions: 14

Compression:

Stored size: 326 Bytes

Contents

module Type
  class ArrayOfConditionsType < ActiveModel::Type::Value
    CONDITION_KEYS = KB::Condition.attribute_types.keys.map(&:to_sym)

    def cast(value)
      (value || []).map do |v|
        next v if v.is_a? KB::Condition

        KB::Condition.new v.symbolize_keys.slice(*CONDITION_KEYS)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
barkibu-kb-0.27.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.26.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.25.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.24.1 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.24.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.23.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.22.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.21.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.20.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.19.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.18.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.17.0 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.16.2 lib/kb/type/array_of_conditions_type.rb
barkibu-kb-0.16.1 lib/kb/type/array_of_conditions_type.rb