flash_gordon 0.0.4 → 0.0.5
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.
- data/lib/flash_gordon/flash.rb +0 -1
- data/lib/flash_gordon/version.rb +1 -1
- data/lib/flash_gordon.rb +18 -5
- data/test/controllers/pages_controller_test.rb +10 -0
- data/test/dummy/app/controllers/pages_controller.rb +5 -0
- data/test/dummy/app/views/layouts/application.html.erb +1 -1
- data/test/dummy/app/views/pages/home.html.erb +1 -0
- data/test/dummy/config/initializers/flash_gordon.rb +3 -0
- data/test/dummy/config/routes.rb +1 -54
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +1202 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/flash_gordon_test.rb +25 -1
- metadata +30 -6
data/lib/flash_gordon/flash.rb
CHANGED
data/lib/flash_gordon/version.rb
CHANGED
data/lib/flash_gordon.rb
CHANGED
@@ -1,30 +1,43 @@
|
|
1
1
|
module FlashGordon
|
2
2
|
mattr_accessor :zones
|
3
|
-
|
3
|
+
mattr_reader :default_zones
|
4
4
|
@@zones = {}
|
5
5
|
|
6
6
|
def self.setup
|
7
7
|
yield self
|
8
8
|
end
|
9
9
|
|
10
|
+
def self.set_default_zones
|
11
|
+
@@default_zones = Hash[@@zones]
|
12
|
+
end
|
13
|
+
|
10
14
|
def self.init_zone
|
11
15
|
zone_list = "warning danger info success error"
|
12
16
|
zone_list.split(" ").each{|z| @@zones[z.to_sym] = []}
|
17
|
+
self.set_default_zones
|
13
18
|
true
|
14
19
|
end
|
15
20
|
|
16
21
|
def self.add_zone(zone)
|
17
22
|
@@zones[zone.to_sym] = [] unless @@zones[zone.to_sym]
|
18
|
-
@@default_zones[zone.to_sym] = [] unless @@zones[zone.to_sym]
|
19
23
|
true
|
20
24
|
end
|
21
25
|
|
22
26
|
def self.reset_zones
|
23
|
-
reset_zones = {}
|
24
27
|
@@zones.each_key do |k|
|
25
|
-
|
28
|
+
@@zones[k] = []
|
26
29
|
end
|
27
|
-
|
30
|
+
@@zones
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.hash_compare(a,b)
|
34
|
+
(a.size > b.size ? a.to_a - b.to_a : b.to_a - a.to_a).flatten
|
35
|
+
end
|
36
|
+
|
37
|
+
private_class_method :hash_compare
|
38
|
+
|
39
|
+
def self.new_zones
|
40
|
+
hash_compare(@@zones, @@default_zones)
|
28
41
|
end
|
29
42
|
|
30
43
|
self.init_zone
|
@@ -0,0 +1 @@
|
|
1
|
+
Pewpewpew
|
data/test/dummy/config/routes.rb
CHANGED
@@ -1,56 +1,3 @@
|
|
1
1
|
Dummy::Application.routes.draw do
|
2
|
-
#
|
3
|
-
# See how all your routes lay out with "rake routes".
|
4
|
-
|
5
|
-
# You can have the root of your site routed with "root"
|
6
|
-
# root 'welcome#index'
|
7
|
-
|
8
|
-
# Example of regular route:
|
9
|
-
# get 'products/:id' => 'catalog#view'
|
10
|
-
|
11
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
12
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
13
|
-
|
14
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
15
|
-
# resources :products
|
16
|
-
|
17
|
-
# Example resource route with options:
|
18
|
-
# resources :products do
|
19
|
-
# member do
|
20
|
-
# get 'short'
|
21
|
-
# post 'toggle'
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# collection do
|
25
|
-
# get 'sold'
|
26
|
-
# end
|
27
|
-
# end
|
28
|
-
|
29
|
-
# Example resource route with sub-resources:
|
30
|
-
# resources :products do
|
31
|
-
# resources :comments, :sales
|
32
|
-
# resource :seller
|
33
|
-
# end
|
34
|
-
|
35
|
-
# Example resource route with more complex sub-resources:
|
36
|
-
# resources :products do
|
37
|
-
# resources :comments
|
38
|
-
# resources :sales do
|
39
|
-
# get 'recent', on: :collection
|
40
|
-
# end
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Example resource route with concerns:
|
44
|
-
# concern :toggleable do
|
45
|
-
# post 'toggle'
|
46
|
-
# end
|
47
|
-
# resources :posts, concerns: :toggleable
|
48
|
-
# resources :photos, concerns: :toggleable
|
49
|
-
|
50
|
-
# Example resource route within a namespace:
|
51
|
-
# namespace :admin do
|
52
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
53
|
-
# # (app/controllers/admin/products_controller.rb)
|
54
|
-
# resources :products
|
55
|
-
# end
|
2
|
+
root 'pages#home'
|
56
3
|
end
|
File without changes
|