dot_hash 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # DotHash
2
2
 
3
- TODO: Write a gem description
3
+ A very efficient gem that lets you use hashes as object properties. It is almost as fast as a plain Hash
4
+ since it's complexity is also linear, `O(n) # where N is the number of nested parents of the given property`.
4
5
 
5
6
  ## Installation
6
7
 
@@ -18,7 +19,13 @@ Or install it yourself as:
18
19
 
19
20
  ## Usage
20
21
 
21
- TODO: Write usage instructions here
22
+ ```ruby
23
+ some_hash = {size: {height: 100, width: 500}, "color" => "red"}
24
+ properties = some_hash.to_properties
25
+
26
+ properties.size.height # returns 100, it is the same as some_hash[:size][:height]
27
+ properties.color # returns "red", it works with Strings and Symbol keys
28
+ ```
22
29
 
23
30
  ## Contributing
24
31
 
@@ -13,7 +13,7 @@ module DotHash
13
13
  private
14
14
 
15
15
  def fetch(key)
16
- simbolize_key key
16
+ symbolize_key key
17
17
  has_key? key and get_value key
18
18
  end
19
19
 
@@ -29,7 +29,7 @@ module DotHash
29
29
  hash[key] = self.class.new value
30
30
  end
31
31
 
32
- def simbolize_key(key)
32
+ def symbolize_key(key)
33
33
  return unless hash.has_key?(key.to_s)
34
34
  hash[key.to_sym] = hash.delete key.to_s
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module DotHash
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dot_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
61
61
  version: '0'
62
62
  segments:
63
63
  - 0
64
- hash: -2562876518148742290
64
+ hash: -1382621053870240237
65
65
  required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  segments:
72
72
  - 0
73
- hash: -2562876518148742290
73
+ hash: -1382621053870240237
74
74
  requirements: []
75
75
  rubyforge_project:
76
76
  rubygems_version: 1.8.24