dotcfg 0.0.1.12 → 0.1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/dotcfg.rb +5 -7
  2. metadata +2 -2
data/lib/dotcfg.rb CHANGED
@@ -7,7 +7,7 @@ require 'yaml'
7
7
  # e.g.
8
8
  # d = DotCfg.new('~/.dotcfg')
9
9
  # d['hello'] = 'world'
10
- # d['hello']
10
+ # d[:hello]
11
11
  # => "world"
12
12
  # d.save
13
13
  # d['get'] = "bent"
@@ -18,12 +18,10 @@ require 'yaml'
18
18
  class DotCfg
19
19
  def self.normalize key
20
20
  case key
21
- when Numeric, Symbol
22
- key # pass thru
23
- when String
24
- # leading numerics are invalid
25
- raise "invalid key: #{key}" if key[0,1] == '0' or key[0,1].to_i != 0
26
- key.downcase.gsub(/[\W_]+/, '_').gsub(/_\z/, '').to_sym
21
+ when Numeric
22
+ key.to_s
23
+ when String, Symbol
24
+ key.to_s.downcase.gsub(/[\W_]+/, '_').gsub(/_\z/, '')
27
25
  else
28
26
  raise "invalid key: #{key} (#{key.class})"
29
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotcfg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.12
4
+ version: 0.1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-19 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: JSON and YAML config serialization and synch
15
15
  email: