snowman_meltdown 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ begin
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = 'snowman_meltdown'
8
8
  gem.summary = %Q{A simple middleware for Rails 3 to vanish _snowman parameter☃☃☃}
9
- gem.description = %Q{goodbye _snowman...}
9
+ gem.description = %Q{goodbye _snowman...☃☃☃}
10
10
  gem.email = 'ronnie@dio.jp'
11
11
  gem.homepage = 'http://github.com/amatsuda/snowman_meltdown'
12
12
  gem.authors = ['Akira Matsuda']
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
@@ -1,8 +1,10 @@
1
+ require File.join(File.dirname(__FILE__), 'snowman_meltdown/target_extractor')
1
2
  require File.join(File.dirname(__FILE__), 'snowman_meltdown/middleware')
2
3
 
3
4
  module SnowmanMeltdown
4
- class Engine < Rails::Engine
5
+ class Railtie < Rails::Railtie
5
6
  initializer 'add middleware' do |app|
7
+ SnowmanMeltdown::Middleware.snowmanish = TargetExtractor.new.extract
6
8
  app.middleware.use SnowmanMeltdown::Middleware
7
9
  end
8
10
  end
@@ -1,12 +1,14 @@
1
1
  module SnowmanMeltdown
2
2
  class Middleware
3
+ cattr_writer :snowmanish
4
+
3
5
  def initialize(app)
4
6
  @app = app
5
7
  end
6
8
 
7
9
  def call(env)
8
10
  @app.call(env).tap do |status, headers, body|
9
- body.body = body.body.sub /<input name="(_snowman|_e)" type="hidden" value="&#9731;" \/>/, '' if body.respond_to? :body
11
+ body.body = body.body.sub @@snowmanish, '' if body.respond_to? :body
10
12
  end
11
13
  end
12
14
  end
@@ -0,0 +1,9 @@
1
+ module SnowmanMeltdown
2
+ class TargetExtractor
3
+ include ActionView::Helpers::FormTagHelper
4
+
5
+ def extract
6
+ extra_tags_for_form('method' => 'get').scan(/<input .*? type="hidden" .*?>/).first
7
+ end
8
+ end
9
+ end
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{snowman_meltdown}
8
- s.version = "0.0.5"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Akira Matsuda"]
12
- s.date = %q{2010-08-11}
13
- s.description = %q{goodbye _snowman...}
12
+ s.date = %q{2010-08-18}
13
+ s.description = %q{goodbye _snowman...☃☃☃}
14
14
  s.email = %q{ronnie@dio.jp}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "lib/snowman_meltdown.rb",
27
27
  "lib/snowman_meltdown/middleware.rb",
28
+ "lib/snowman_meltdown/target_extractor.rb",
28
29
  "snowman_meltdown.gemspec",
29
30
  "spec/snowman_meltdown_spec.rb",
30
31
  "spec/spec.opts",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snowman_meltdown
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 5
10
- version: 0.0.5
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akira Matsuda
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-11 00:00:00 +09:00
18
+ date: 2010-08-18 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -36,7 +36,9 @@ dependencies:
36
36
  version: 2.0.0.beta.19
37
37
  type: :development
38
38
  version_requirements: *id001
39
- description: goodbye _snowman...
39
+ description: !binary |
40
+ Z29vZGJ5ZSBfc25vd21hbi4uLuKYg+KYg+KYgw==
41
+
40
42
  email: ronnie@dio.jp
41
43
  executables: []
42
44
 
@@ -54,6 +56,7 @@ files:
54
56
  - VERSION
55
57
  - lib/snowman_meltdown.rb
56
58
  - lib/snowman_meltdown/middleware.rb
59
+ - lib/snowman_meltdown/target_extractor.rb
57
60
  - snowman_meltdown.gemspec
58
61
  - spec/snowman_meltdown_spec.rb
59
62
  - spec/spec.opts