rails_current 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rails_current.rb CHANGED
@@ -4,7 +4,7 @@ require 'map'
4
4
 
5
5
  module Current
6
6
  def Current.version
7
- '1.4.1'
7
+ '1.5.0'
8
8
  end
9
9
 
10
10
  def Current.data
@@ -59,17 +59,16 @@ module Current
59
59
  end
60
60
 
61
61
  def Current.define_attribute_method(name)
62
+ name = name.to_s
62
63
  unless respond_to?(name)
63
64
  singleton_class.module_eval do
64
65
  define_method(name) do
65
- if data.has_key?(name) and !data[name].nil?
66
- data[name]
67
- else
68
- if generator = generators[name]
69
- value = generator.call
70
- data[name] = value
71
- end
66
+ value = data[name]
67
+ if value.nil? and generator = generators[name]
68
+ value = generator.call
69
+ data[name] = value
72
70
  end
71
+ value
73
72
  end
74
73
 
75
74
  define_method(name + '=') do |value|
@@ -135,7 +134,8 @@ module Current
135
134
  case method.to_s
136
135
  when /^current_(.*)$/
137
136
  msg = $1
138
- Current.send(msg, *args, &block)
137
+ value = Current.send(msg, *args, &block)
138
+
139
139
  else
140
140
  super
141
141
  end
@@ -146,7 +146,6 @@ def Current(*args, &block)
146
146
  Current.attribute(*args, &block)
147
147
  end
148
148
 
149
-
150
149
  if defined?(Rails)
151
150
 
152
151
  ##
@@ -167,6 +166,7 @@ if defined?(Rails)
167
166
  Current.controller = controller
168
167
  end
169
168
 
169
+ extend Current
170
170
  include Current
171
171
  helper{ include Current }
172
172
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_current"
6
- spec.version = "1.4.1"
6
+ spec.version = "1.5.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_current"
9
9
  spec.description = "description: rails_current kicks the ass"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_current
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-15 00:00:00.000000000 Z
12
+ date: 2012-01-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'description: rails_current kicks the ass'
15
15
  email: ara.t.howard@gmail.com