Sha256: 4a311fa509f8653259a4b590492b132e6971d0cb84bb8a420b8f062ac0efbe7b

Contents?: true

Size: 449 Bytes

Versions: 7

Compression:

Stored size: 449 Bytes

Contents

# frozen_string_literal: true

module Sail
  module Types
    # Set
    #
    # This type allows defining a set
    #  using a string and a separator
    # (defined in the configuration).
    class Set < Type
      def to_value
        ::Set[*@setting.value.split(Sail.configuration.array_separator)]
      end

      def from(value)
        value.is_a?(::String) ? value : value.join(Sail.configuration.array_separator)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sail-3.6.1 lib/sail/types/set.rb
sail-3.6.0 lib/sail/types/set.rb
sail-3.5.1 lib/sail/types/set.rb
sail-3.5.0 lib/sail/types/set.rb
sail-3.4.0 lib/sail/types/set.rb
sail-3.3.0 lib/sail/types/set.rb
sail-3.2.4 lib/sail/types/set.rb