resourceful_loader 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/resourceful_loader.rb +3 -2
  2. metadata +4 -4
@@ -26,6 +26,7 @@ module ResourcefulLoader
26
26
  method_name = "load_#{resource_name}"
27
27
 
28
28
  ivar_name = (options.delete(:as) || resource_name).to_s
29
+ attr_accessor ivar_name
29
30
 
30
31
  while private_instance_methods.include? method_name
31
32
  method_name.sub! /(?:_([0-9]+))?$/ do |f|
@@ -47,8 +48,8 @@ module ResourcefulLoader
47
48
  if resource.nil? && if_nil && !if_nil.to_proc.call(self)
48
49
  return false
49
50
  end
50
-
51
- instance_variable_set :"@#{ivar_name}", resource
51
+
52
+ send("#{ivar_name}=", resource) unless send(ivar_name)
52
53
  end
53
54
 
54
55
  private method_name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resourceful_loader
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - jbr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-28 00:00:00 -07:00
18
+ date: 2010-11-03 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21