Class: Dynomite::Config
- Inherits:
-
Object
- Object
- Dynomite::Config
- Defined in:
- lib/dynomite/config.rb
Instance Attribute Summary collapse
-
#default_count_method ⇒ Object
Returns the value of attribute default_count_method.
-
#default_field_type ⇒ Object
Returns the value of attribute default_field_type.
-
#default_namespace ⇒ Object
Returns the value of attribute default_namespace.
-
#discover_fields ⇒ Object
Returns the value of attribute discover_fields.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#env ⇒ Object
Returns the value of attribute env.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#migration ⇒ Object
Returns the value of attribute migration.
- #namespace ⇒ Object
-
#namespace_separator ⇒ Object
Returns the value of attribute namespace_separator.
-
#undeclared_field_behavior ⇒ Object
Returns the value of attribute undeclared_field_behavior.
-
#update_strategy ⇒ Object
Returns the value of attribute update_strategy.
-
#warn_on_scan ⇒ Object
Returns the value of attribute warn_on_scan.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dynomite/config.rb', line 6 def initialize @logger = Logger.new($stderr) @logger.formatter = ActiveSupport::Logger::SimpleFormatter.new @log_level = :info @namespace_separator = "_" @endpoint = ENV['DYNOMITE_ENDPOINT'] # allow to use local dynamodb @env = ActiveSupport::StringInquirer.new(ENV['DYNOMITE_ENV'] || "development") @default_count_method = :count # slow but accurate. :item_count is faster but can be stale by 6 hours @warn_on_scan = true @discover_fields = false @migration = ActiveSupport::OrderedOptions.new @undeclared_field_behavior = :warn # warn silent error allow # Not implemented: :datetime, :date, :float, :array, :set, :map # as we aws-sdk-dynamodb handles it via :infer @default_field_type = :infer # :string, :integer, :boolean, :time, :infer @update_strategy = :put_item # :put_item, :update_item end |
Instance Attribute Details
#default_count_method ⇒ Object
Returns the value of attribute default_count_method.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def default_count_method @default_count_method end |
#default_field_type ⇒ Object
Returns the value of attribute default_field_type.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def default_field_type @default_field_type end |
#default_namespace ⇒ Object
Returns the value of attribute default_namespace.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def default_namespace @default_namespace end |
#discover_fields ⇒ Object
Returns the value of attribute discover_fields.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def discover_fields @discover_fields end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def endpoint @endpoint end |
#env ⇒ Object
Returns the value of attribute env.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def env @env end |
#log_level ⇒ Object
Returns the value of attribute log_level.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def logger @logger end |
#migration ⇒ Object
Returns the value of attribute migration.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def migration @migration end |
#namespace ⇒ Object
35 36 37 |
# File 'lib/dynomite/config.rb', line 35 def namespace ENV['DYNOMITE_NAMESPACE'] || @namespace || @default_namespace || 'dynomite' end |
#namespace_separator ⇒ Object
Returns the value of attribute namespace_separator.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def namespace_separator @namespace_separator end |
#undeclared_field_behavior ⇒ Object
Returns the value of attribute undeclared_field_behavior.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def undeclared_field_behavior @undeclared_field_behavior end |
#update_strategy ⇒ Object
Returns the value of attribute update_strategy.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def update_strategy @update_strategy end |
#warn_on_scan ⇒ Object
Returns the value of attribute warn_on_scan.
3 4 5 |
# File 'lib/dynomite/config.rb', line 3 def warn_on_scan @warn_on_scan end |