sinatra-conditions 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sinatra/conditions.rb +24 -0
  3. metadata +58 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5820a4df7390d7c4e0214116201a000c020bcec7
4
+ data.tar.gz: 445ca5646ab6ac3c106f8e488b5091b558050519
5
+ SHA512:
6
+ metadata.gz: 1bc0bfc3236d013dcc295cce41a0b783b0f8eafdcf1ff7b66541fd98d4933f89c73e6a885df4caddeb237fda9cfb9d67bd1ccc75f966b17bf93925939bfd27b9
7
+ data.tar.gz: 0d8d0def32b91a9691cc5bf9ea2411adbd5358eb2861d3aedd76b5871af80db77d3347ab00e5013c0caa6642e22c9fecf1bc2af7c7eee7ba1f248020da6edd7a
@@ -0,0 +1,24 @@
1
+ require 'sinatra/base'
2
+
3
+ module Sinatra
4
+ module Conditions
5
+
6
+ def self.included(app)
7
+ app.register self
8
+ end
9
+
10
+ def self.registered(app)
11
+
12
+ ## For method condition
13
+ ## Example: `before '/', :method => :post do`
14
+ app.set(:method) do |method|
15
+ method = method.to_s.upcase
16
+ condition { request.request_method == method }
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
23
+ register Conditions
24
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-conditions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Alexander Popov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sinatra
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1'
27
+ description: Sinatra Conditions gives you the ability to use additional conditions.
28
+ email: alex.wayfer@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/sinatra/conditions.rb
34
+ homepage: https://bitbucket.org/AlexWayfer/sinatra-conditions
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.4.5
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Sinatra Extension for additional conditions
58
+ test_files: []