Sha256: 7a103d76bd0e1fa8c191c27deee9d1a52cfd7bdfe716a4532e9111068d11f896

Contents?: true

Size: 508 Bytes

Versions: 9

Compression:

Stored size: 508 Bytes

Contents

require "set"

module JsonSpec
  module Configuration
    DEFAULT_EXCLUDED_KEYS = %w(id created_at updated_at)

    def configure(&block)
      instance_eval(&block)
    end

    def excluded_keys
      @excluded_keys ||= DEFAULT_EXCLUDED_KEYS
    end

    def excluded_keys=(keys)
      @excluded_keys = keys.map{|k| k.to_s }.uniq
    end

    def exclude_keys(*keys)
      self.excluded_keys = keys
    end

    def reset
      instance_variables.each{|iv| remove_instance_variable(iv) }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
json_spec-0.8.1 lib/json_spec/configuration.rb
json_spec-0.8.0 lib/json_spec/configuration.rb
json_spec-0.7.0 lib/json_spec/configuration.rb
json_spec-0.6.0 lib/json_spec/configuration.rb
json_spec-0.5.0 lib/json_spec/configuration.rb
json_spec-0.4.0 lib/json_spec/configuration.rb
json_spec-0.3.0 lib/json_spec/configuration.rb
json_spec-0.2.0 lib/json_spec/configuration.rb
json_spec-0.1.0 lib/json_spec/configuration.rb