Sha256: 0d020c70d4d45c0f3410d23e95300d24255e7371728387f32ba40366586472a9

Contents?: true

Size: 635 Bytes

Versions: 2

Compression:

Stored size: 635 Bytes

Contents

module SimpleModel
  class Config
    DEFAULTS = {
      :initialize_defaults  => false,
      :attributes_store     => :string # OPTIONS => :string, :symbol, :indifferent
    }.freeze

    ATTRIBUTE_STORES = {
      :symbol => :to_sym,
      :string => :to_s,
      :indifferent => :to_s
    }.freeze

    attr_accessor :initialize_defaults
    alias :initialize_defaults? :initialize_defaults

    attr_accessor :attributes_store

    def initialize
      DEFAULTS.each do |setting, val|
        self.send("#{setting}=", val)
      end
    end

    def attibutes_store_cast
      ATTRIBUTE_STORES[attributes_store]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_model-1.4.0 lib/simple_model/config.rb
simple_model-1.3.0 lib/simple_model/config.rb