flash_gordon 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flash_gordon/flash.rb +30 -30
- data/lib/flash_gordon/version.rb +1 -1
- metadata +2 -3
- data/MIT-LICENSE +0 -20
data/lib/flash_gordon/flash.rb
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
module FlashGordon
|
2
|
-
|
2
|
+
class Flash
|
3
3
|
# Messages fall under different message zones, for now zones are hardcoded
|
4
4
|
# eventually we can add custom ones via initializers
|
5
5
|
|
6
|
-
|
6
|
+
@messages = {:error => [], :alert => [], :info => [], :log => [], :success => [], :warning => [], :danger => []}
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
def self.append(message,zone=:warning, options={})
|
9
|
+
# Added options for future use
|
10
|
+
if @messages[zone]
|
11
|
+
if message.class == Array
|
12
|
+
message.each do |m|
|
13
|
+
@messages[zone] << m
|
14
|
+
end
|
15
|
+
else
|
16
|
+
@messages[zone] << message
|
17
|
+
end
|
18
|
+
else
|
19
|
+
raise "Zone does not exist, please use the following zones - :error, :info, :log, :success, :warning, :alert"
|
20
|
+
end
|
21
|
+
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
23
|
+
def self.render(zone=:all, glue="\n")
|
24
|
+
if zone == :all
|
25
|
+
@messages.each_pair do |k,v|
|
26
|
+
@messages[k] = v.join(glue) unless v.empty?
|
27
|
+
end
|
28
|
+
@messages
|
29
|
+
elsif @messages[zone]
|
30
|
+
@messages[zone].join(glue)
|
31
|
+
end
|
32
|
+
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
def self.reset
|
35
|
+
@messages = {:error => [], :alert => [], :info => [], :log => [], :success => [], :warning => [], :danger => []}
|
36
|
+
end
|
37
|
+
end
|
38
38
|
end
|
data/lib/flash_gordon/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: flash_gordon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ernest Sim
|
@@ -59,7 +59,6 @@ files:
|
|
59
59
|
- lib/flash_gordon/version.rb
|
60
60
|
- lib/flash_gordon.rb
|
61
61
|
- lib/tasks/flash_gordon_tasks.rake
|
62
|
-
- MIT-LICENSE
|
63
62
|
- Rakefile
|
64
63
|
- test/dummy/app/assets/javascripts/application.js
|
65
64
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -94,7 +93,7 @@ files:
|
|
94
93
|
- test/dummy/README.rdoc
|
95
94
|
- test/flash_gordon_test.rb
|
96
95
|
- test/test_helper.rb
|
97
|
-
homepage:
|
96
|
+
homepage: https://github.com/methodnow/flash_gordon
|
98
97
|
licenses: []
|
99
98
|
post_install_message:
|
100
99
|
rdoc_options: []
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright 2013 YOURNAME
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|