kelredd-resourceful 0.5.8 → 0.5.9

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.
@@ -33,7 +33,7 @@ module Resourceful
33
33
  @attributes = {}
34
34
  self.class.ancestors.each do |anc|
35
35
  if @@attributes[anc.to_s]
36
- @attributes.merge!(@@attributes[anc.to_s].inject({}) { |hsh, key| hsh[key] = self.send(key); hsh })
36
+ @attributes.merge!(@@attributes[anc.to_s].inject({}) { |hsh, key| hsh[key] = self.send("_#{key}"); hsh })
37
37
  end
38
38
  end
39
39
  end
@@ -88,16 +88,15 @@ module Resourceful
88
88
  else
89
89
  'to_s'
90
90
  end
91
+ # method to get the raw attribute variable data (not intended to be overridden)
92
+ define_method("_#{clean_name}") do
93
+ fetch_attribute(clean_name, config, content_method)
94
+ end
95
+ # method to read the attribute value (intended to be overridden when necessary)
91
96
  define_method(name) do
92
- instance_variable_get("@#{clean_name}") || \
93
- instance_variable_set("@#{clean_name}", \
94
- if ((a = attribute(config)) && a.kind_of?(String))
95
- self.class.get_value(a, config).send(content_method)
96
- else
97
- a
98
- end
99
- )
97
+ fetch_attribute(clean_name, config, content_method)
100
98
  end
99
+ # method to write the attribute value
101
100
  define_method("#{name}=") do |value|
102
101
  instance_variable_set("@#{clean_name}", value)
103
102
  end
@@ -155,6 +154,17 @@ module Resourceful
155
154
 
156
155
  private
157
156
 
157
+ def fetch_attribute(clean_name, config, content_method)
158
+ instance_variable_get("@#{clean_name}") || \
159
+ instance_variable_set("@#{clean_name}", \
160
+ if ((a = attribute(config)) && a.kind_of?(String))
161
+ self.class.get_value(a, config).send(content_method)
162
+ else
163
+ a
164
+ end
165
+ )
166
+ end
167
+
158
168
  def reset_attributes
159
169
  clear_attributes
160
170
  attributes(true)
@@ -3,7 +3,7 @@ module Resourceful
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 5
6
- TINY = 8
6
+ TINY = 9
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kelredd-resourceful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-19 00:00:00 -07:00
12
+ date: 2009-08-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -104,7 +104,6 @@ files:
104
104
  - lib/resourceful.rb
105
105
  has_rdoc: false
106
106
  homepage: ""
107
- licenses:
108
107
  post_install_message:
109
108
  rdoc_options:
110
109
  - --main
@@ -126,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
125
  requirements: []
127
126
 
128
127
  rubyforge_project:
129
- rubygems_version: 1.3.5
128
+ rubygems_version: 1.2.0
130
129
  signing_key:
131
130
  specification_version: 3
132
131
  summary: A ruby gem to abstract web resource handling.