constructable 0.2.3 → 0.2.4
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.
- data/VERSION +1 -1
- data/constructable.gemspec +2 -2
- data/lib/constructable/constructor.rb +1 -2
- data/lib/constructable/core_ext.rb +1 -1
- data/test/constructable/test_constructable.rb +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/constructable.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{constructable}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Manuel Korfmann"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-12}
|
13
13
|
s.description = %q{
|
14
14
|
Adds the class macro Class#constructable to easily define what attributes a Class accepts provided as a hash to Class#new.
|
15
15
|
Attributes can be configured in their behaviour in case they are not provided or are in the wrong format.
|
@@ -8,12 +8,11 @@ module Constructable
|
|
8
8
|
constructor = self
|
9
9
|
@klass.define_singleton_method(:new) do |*args, &block|
|
10
10
|
obj = self.allocate
|
11
|
-
constructor_hash = Hash === args.last ? args.
|
11
|
+
constructor_hash = Hash === args.last ? args.last : {}
|
12
12
|
constructor.construct(constructor_hash, obj)
|
13
13
|
obj.send :initialize, *args, &block
|
14
14
|
obj
|
15
15
|
end
|
16
|
-
|
17
16
|
self.define_attributes_method
|
18
17
|
end
|
19
18
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: constructable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Manuel Korfmann
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-12 00:00:00 +02:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
hash: -
|
106
|
+
hash: -1734599671061646461
|
107
107
|
segments:
|
108
108
|
- 0
|
109
109
|
version: "0"
|