demeter 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/demeter.rb +1 -1
  3. data/spec/demeter_spec.rb +8 -0
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require "rake/gempackagetask"
3
3
 
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = %q{demeter}
6
- s.version = "1.0.2"
6
+ s.version = "1.0.3"
7
7
  s.authors = ['Emerson Macedo']
8
8
  s.email = ['emerleite@gmail.com']
9
9
  s.date = %q{2009-11-11}
data/lib/demeter.rb CHANGED
@@ -21,7 +21,7 @@ module Demeter
21
21
  raise NoMethodError if Demeter.demeter_objects[self.class.to_s.to_sym].select { |object| message_split.first.to_sym == object }.length == 0
22
22
  object = self.send(message_split.first)
23
23
  message_split.delete message_split.first
24
- object.send(message_split.join("_"))
24
+ object ? object.send(message_split.join("_")) : nil
25
25
  end
26
26
  end
27
27
  end
data/spec/demeter_spec.rb CHANGED
@@ -214,4 +214,12 @@ describe Demeter do
214
214
  instance.person = person
215
215
  instance.person_name.should be_eql("name overrided")
216
216
  end
217
+
218
+ it 'Should return nil when demetered object is nil' do
219
+ AClass.send(:attr_accessor, :person)
220
+ AClass.demeter :person
221
+
222
+ instance = AClass.new
223
+ instance.person_name.should be_nil
224
+ end
217
225
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: demeter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerson Macedo