Sha256: 28b2ea7afcee9374112ec472a211b2c3aeb5ad3adc821c918690637e6a666c5b

Contents?: true

Size: 672 Bytes

Versions: 6

Compression:

Stored size: 672 Bytes

Contents

module ActiveSnapshot
  class Config
    attr_reader :storage_method

    def initialize
      @storage_method = 'serialized_json'
    end

    def storage_method=(value)
      value_str = value.to_s

      if ['serialized_yaml', 'serialized_json', 'native_json'].include?(value_str)
        @storage_method = value_str
      else
        raise ArgumentError.new("Invalid storage_method provided")
      end
    end

    def storage_method_yaml?
      @storage_method == 'serialized_yaml'
    end

    def storage_method_json?
      @storage_method == 'serialized_json'
    end

    def storage_method_native_json?
      @storage_method == 'native_json'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_snapshot-0.5.1 lib/active_snapshot/config.rb
active_snapshot-0.5.0 lib/active_snapshot/config.rb
active_snapshot-0.4.0 lib/active_snapshot/config.rb
active_snapshot-0.3.2 lib/active_snapshot/config.rb
active_snapshot-0.3.1 lib/active_snapshot/config.rb
active_snapshot-0.3.0 lib/active_snapshot/config.rb