Class: Hoodie::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/hoodie/configuration.rb

Overview

A Configuration instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialized a configuration instance

Yields:

  • (_self)

Yield Parameters:



42
43
44
45
46
47
48
49
# File 'lib/hoodie/configuration.rb', line 42

def initialize(options={})
  @logging = options.fetch(:logging,   false)
  @level   = options.fetch(:level,     :info)
  @store   = options.fetch(:store, :memstore)
  @crypto  = Crypto::Configuration.new

  yield self if block_given?
end

Instance Attribute Details

#levelSymbol

Returns Set the desired loging level.

Returns:

  • (Symbol)

    Set the desired loging level.



31
32
33
# File 'lib/hoodie/configuration.rb', line 31

def level
  @level
end

#loggingBoolean

Returns Enable or disable logging.

Returns:

  • (Boolean)

    Enable or disable logging.



27
28
29
# File 'lib/hoodie/configuration.rb', line 27

def logging
  @logging
end

#storeSymbol

Returns The current Stash Store.

Returns:

  • (Symbol)

    The current Stash Store.



35
36
37
# File 'lib/hoodie/configuration.rb', line 35

def store
  @store
end

Instance Method Details

#crypto(&block) ⇒ Crypto

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Access the crypto for this instance and optional configure a new crypto with the passed block.

Examples:

Garcon.config do |c|
  c.crypto.password = "!mWh0!s@y!m"
  c.crypto.salt     = "9e5f851900cad8892ac8b737b7370cbe"
end

Returns:



63
64
65
66
# File 'lib/hoodie/configuration.rb', line 63

def crypto(&block)
  @crypto = Crypto::Configuration.new(&block) if block_given?
  @crypto
end

#to_hObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



69
70
71
72
73
74
# File 'lib/hoodie/configuration.rb', line 69

def to_h
  { logging: logging,
    level:   level,
    store:   store
  }.freeze
end