Class: Snarl::SNP::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/snarl/snp/config.rb

Defined Under Namespace

Classes: Normalize

Constant Summary collapse

DEFAULT_HOST =
'127.0.0.1'
DEFAULT_PORT =
9887

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
11
# File 'lib/snarl/snp/config.rb', line 8

def initialize
  @config = {}
  default_config
end

Instance Attribute Details

#configObject (readonly)

mainly for debug



13
14
15
# File 'lib/snarl/snp/config.rb', line 13

def config
  @config
end

Instance Method Details

#[](k) ⇒ Object



22
# File 'lib/snarl/snp/config.rb', line 22

def [](k) ; @config[k.to_s] ; end

#[]=(k, v) ⇒ Object



21
# File 'lib/snarl/snp/config.rb', line 21

def []=(k, v) ; Normalize.store(k, v, @config) ; end

#resetObject



23
# File 'lib/snarl/snp/config.rb', line 23

def reset ; @config = {} ; end

#to_yamlObject



24
# File 'lib/snarl/snp/config.rb', line 24

def to_yaml ; @config.to_yaml ; end