constructable 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.3
1
+ 0.2.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{constructable}
8
- s.version = "0.2.3"
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-10}
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.pop : {}
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
 
@@ -1,5 +1,5 @@
1
1
  module Constructable
2
- class ::Class
2
+ class ::Module
3
3
  include Constructable
4
4
 
5
5
  # @example
@@ -37,7 +37,7 @@ describe 'integration' do
37
37
  klass = Class.new
38
38
  klass.constructable [:bar, accessible: true]
39
39
  klass.class_eval do
40
- def initialize
40
+ def initialize(options = {})
41
41
  self.bar = 20
42
42
  end
43
43
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: constructable
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.3
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-10 00:00:00 +02:00
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: -3265931130624330065
106
+ hash: -1734599671061646461
107
107
  segments:
108
108
  - 0
109
109
  version: "0"