hstruct 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,7 +1,11 @@
1
- ## v0.2.0
1
+ ### v0.3.0
2
+
3
+ * it can be instantiated with no arguments
4
+
5
+ ### v0.2.0
2
6
 
3
7
  * when converting back to a hash, leave empty values out
4
8
 
5
- ## v0.1.0
9
+ ### v0.1.0
6
10
 
7
11
  Initial release
data/hstruct.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "hstruct"
7
- spec.version = "0.2.0"
7
+ spec.version = "0.3.0"
8
8
  spec.authors = ["Gerhard Lazu"]
9
9
  spec.email = ["gerhard@lazu.co.uk"]
10
10
  spec.description = %q{Struct with the convenience of instantiating from a Hash}
data/lib/hstruct.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class HStruct < Struct
2
- def initialize(args)
3
- super(*members.map { |m| args[m] })
2
+ def initialize(args = nil)
3
+ super(*members.map { |m| args[m] }) if args
4
4
  end
5
5
 
6
6
  def to_hash
@@ -9,6 +9,10 @@ describe HStruct do
9
9
  Person.ancestors.should include Struct
10
10
  end
11
11
 
12
+ it "can be instantiated with no arguments" do
13
+ expect { Person.new }.to_not raise_error(ArgumentError)
14
+ end
15
+
12
16
  it "can be instantiated from hash" do
13
17
  person = Person.new(:first_name => "Jimmy")
14
18
  person.first_name.should eql "Jimmy"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hstruct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: