Sha256: 67f7598cd6bec5df97a8bbc9bf430bbae3b1df5be08e17eee568288c06c5f573

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

class Serega
  module Plugins
    module Metadata
      class MetaAttribute
        class CheckOptHideNil
          class << self
            #
            # Checks attribute :after_hide_if option
            #
            # @param opts [Hash] Attribute options
            #
            # @raise [Error] Error that option has invalid value
            #
            # @return [void]
            #
            def call(opts)
              return unless opts.key?(:hide_nil)

              value = opts[:hide_nil]
              return if value == true

              raise Error, "Invalid option :hide_nil => #{value.inspect}. Must be true"
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
serega-0.1.5 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb
serega-0.1.4 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb
serega-0.1.3 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb
serega-0.1.2 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb
serega-0.1.1 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb
serega-0.1.0 lib/serega/plugins/metadata/validations/check_opt_hide_nil.rb