iceburn 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba5196ab435fc62388caaf8ad53b582732163a3f
4
- data.tar.gz: 545368d9b0c7deee1d1d94598f539297d36ffec6
3
+ metadata.gz: a79b92788b7e450df00428879d8d7dd0ca3e167b
4
+ data.tar.gz: 6be5570ba58214811d2f6de1a24054611e741e59
5
5
  SHA512:
6
- metadata.gz: 3a6cbf3c347b7f7fe3b09c317ea073fbcf22cc8a17111eb6124216a6105300574b56961689de858cef81dcd7ca1f3623870d7d41eb7a3547a0fb2d88a23dac70
7
- data.tar.gz: 46b4fdfbde101a71413ca4ec71f8a0a350ea092c420f0290f970d5a49062c60ac6a3fea6437a1678fd92922e224105a1c463d0152c8ef175a3659dd983f47c14
6
+ metadata.gz: 75d359fc1d953c7cb4d02861436ab11cf6cc3bae559434e6cc31c855cefd2aacc120a6e82f71c79538536e5e5dc384666424f7a2de3bd3223ada3c08cd8f4996
7
+ data.tar.gz: 9597602fbc7fc5bfb8cf3f45cfa126f7b874f03f8d610dfba4a14ac72f318836b3ab8e163b4821c36df8a45084e46decb1f533c0493f465517ea1f7bf3629323
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- iceburn (0.0.2)
4
+ iceburn (0.0.3)
5
5
  rails
6
6
 
7
7
  GEM
@@ -1,12 +1,9 @@
1
- require 'iceburn/whitelist'
2
-
3
1
  # The before_filter used to handle HTML requests that aren't caught by
4
- # the main application routes.
2
+ # the main application routes. Can also be used in conjunction with
3
+ # Iceburn::Whitelist.
5
4
 
6
5
  module Iceburn
7
6
  module Filters
8
- include Whitelist
9
-
10
7
  # Return blank on all requests to the root path.
11
8
  def index
12
9
  handle_html_requests
@@ -14,15 +11,20 @@ module Iceburn
14
11
 
15
12
  protected
16
13
  def handle_html_requests
17
- return if json_request? || whitelisted?
18
- return if request.xhr?
19
- render text: '', layout: 'application' and return # block the rest of the chain
14
+ render text: '', layout: 'application' and return unless skip?
20
15
  end
21
16
 
22
17
  private
18
+ def skip?
19
+ json_request? || xhr_request? || whitelisted?
20
+ end
23
21
 
24
22
  def json_request?
25
23
  "#{params[:format]}" == 'json'
26
24
  end
25
+
26
+ def xhr_request?
27
+ request.xhr?
28
+ end
27
29
  end
28
30
  end
@@ -1,8 +1,13 @@
1
+ require 'iceburn/filters'
2
+ require 'iceburn/routes'
3
+ require 'iceburn/whitelist'
4
+
1
5
  module Iceburn
2
6
  # Hook into Rails.
3
7
  class Railtie < Rails::Railtie
4
8
  initializer 'iceburn.add_filters' do
5
9
  ActionController::Base.class_eval do
10
+ include Iceburn::Whitelist
6
11
  include Iceburn::Filters
7
12
  end
8
13
  end
@@ -1,3 +1,3 @@
1
1
  module Iceburn
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -24,7 +24,6 @@ module Iceburn
24
24
  iceburn_whitelisted_controllers.include? params[:controller]
25
25
  end
26
26
 
27
- private
28
27
  def iceburn_whitelisted_controllers
29
28
  self.class.iceburn_whitelisted_controllers || []
30
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iceburn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Scott
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-20 00:00:00.000000000 Z
11
+ date: 2014-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails