hashed_struct 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/lib/hashed_struct.rb +3 -5
- data/lib/hashed_struct/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bca9e1bf25e49cfc9e4e11d1cd0ebb59db3d7a06
|
4
|
+
data.tar.gz: 066b6f6965b0d8a75ce4684c5211f1def3f36ec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e917e0c7ff473716908ac6751a13130f466f7644cd6ee431056cc5b5006066a210608fac065e3ffc56b883acf3e885444e12b0b0c644858efb72ca32bb133818
|
7
|
+
data.tar.gz: e2174dbc0a9027250ae6d7a96680f5dce3d35495de0dcc08aed7c05edf3aaf693e53da5d9ebaeb629496f59e61955de3e666b008565396583a89b4cdb4d290f1
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ Struct with hash as initialization argument, to avoid dependency on positional a
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'hashed_struct', '~> 0.0.
|
9
|
+
gem 'hashed_struct', '~> 0.0.2'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -33,3 +33,7 @@ Person.new(name: 'Joe', age: 30, gender: 'Male')
|
|
33
33
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
34
|
4. Push to the branch (`git push origin my-new-feature`)
|
35
35
|
5. Create a new Pull Request
|
36
|
+
|
37
|
+
## Special thanks
|
38
|
+
- Hanmac (#ruby on freenode)
|
39
|
+
- apeiros (#ruby on freenode)
|
data/lib/hashed_struct.rb
CHANGED
@@ -3,11 +3,9 @@ require 'hashed_struct/version'
|
|
3
3
|
class HashedStruct
|
4
4
|
|
5
5
|
def self.new(*fields)
|
6
|
-
Struct.new(*fields)
|
7
|
-
|
8
|
-
|
9
|
-
super(*options.values_at(*self.class.members))
|
10
|
-
end
|
6
|
+
Struct.new(*fields) do
|
7
|
+
def initialize(options={})
|
8
|
+
super(*options.values_at(*self.class.members))
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|