cockpit 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,10 @@ module Cockpit
16
16
  send(:cockpit).send(key)
17
17
  end
18
18
 
19
+ define_method "#{key}=" do |value|
20
+ send(:cockpit).send("#{key}=", value)
21
+ end
22
+
19
23
  define_method "#{key}?" do
20
24
  send(:cockpit).present?(key)
21
25
  end
@@ -111,7 +111,7 @@ module Cockpit
111
111
  end
112
112
 
113
113
  def [](key)
114
- self.store[key.to_s] || default(key.to_s)
114
+ store.has_key?(key.to_s) ? self.store[key.to_s] : default(key.to_s)
115
115
  end
116
116
 
117
117
  def []=(key, value)
@@ -186,7 +186,7 @@ module Cockpit
186
186
  def method_missing(method, *args, &block)
187
187
  if method.to_s =~ /(\w+)\?$/
188
188
  present?($1)
189
- elsif has_key?(method)
189
+ elsif has_key?(method.to_s.gsub("=", ""))
190
190
  Cockpit::Scope.new(self, method, *args, &block)
191
191
  else
192
192
  super(method, *args, &block)
@@ -48,7 +48,7 @@ module Cockpit
48
48
  end
49
49
 
50
50
  def key?(key)
51
- !!self[key]
51
+ !!find_setting(key)
52
52
  end
53
53
 
54
54
  def has_key?(key)
@@ -59,11 +59,12 @@ module Cockpit
59
59
  setting = find_setting(key)
60
60
  setting ? setting.parsed_value : nil
61
61
  end
62
-
62
+
63
63
  def []=(key, value)
64
64
  record.save! if record && record.new_record?
65
65
 
66
66
  setting = find_setting(key)
67
+
67
68
  attributes = {:value => {'root' => value}.to_json}#.merge(configurable_attributes)
68
69
 
69
70
  if setting
@@ -73,8 +74,11 @@ module Cockpit
73
74
  setting.key = key
74
75
  record.settings << setting if record
75
76
  setting.save!
76
- cache << setting
77
77
  end
78
+
79
+ @cache = nil
80
+
81
+ setting.parsed_value
78
82
  end
79
83
 
80
84
  def delete(key)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cockpit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lance Pollard
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-20 00:00:00 -05:00
18
+ date: 2010-09-21 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency