busker 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 129bb0b9aea148dfb5c808d94dc6ebb3af56199f
4
- data.tar.gz: 09a568f551d8acfbe486539c31803981f5906b8a
3
+ metadata.gz: 479d0314b2b96aa30c911d939ad80b2bc8b1df76
4
+ data.tar.gz: 7d9aba7ffc423e2c566a7dfab46abcebad2c8925
5
5
  SHA512:
6
- metadata.gz: a206b4814b6e6855b212c3edee57ec77b6005019b7d1c5f31555fd7c19d52d1833ccd45566990b176e22252d01cb83456b7b7d73ab719aafa57a6ad60d130d77
7
- data.tar.gz: 53a951d8510e1381be474c58a2f0732d490a3a894d6f6f5509dc577e62c277da2fb710d9747c7add770f976afcc923036d756da426a22f3f61ae14e16f8e0766
6
+ metadata.gz: 78b54d4eff9e762c78a661791b9539348ec0f4cd44dee41800531881ed78ddd9d9546f7eb4d8f12fd48c41d8b7a2d57fe6f9ff7bcc779c316252b78460378f10
7
+ data.tar.gz: 86396ccdde4f1dc4f304842c439a70b2b08292aab40275eb9bbd71005cf7aede2e0bbd52ae87cf88e721db38190176f8bda082a8245b1e76f2a58c06b97a8dd5
data/README.md CHANGED
@@ -62,7 +62,7 @@ Or install it yourself as:
62
62
 
63
63
  ## Design principles
64
64
 
65
- * Small code base that is easy to understandable and hackable
65
+ * Small code base that is easily to understandable and hackable
66
66
  * Such a tiny code base that you can just copy it into your one-file-project without the need to require a Gem
67
67
  * No dependencies except what is in the Ruby Standard Lib
68
68
  * Backward compatibility to older Ruby versions
@@ -74,6 +74,7 @@ Or install it yourself as:
74
74
 
75
75
  * Improve render method, allow yield etc
76
76
  * Improve error handling, honor production/development environment?
77
+ * Tests? ;)
77
78
  * Auto reload?
78
79
  * Anything cool that doesn't break the design principles ...
79
80
 
@@ -1,3 +1,3 @@
1
1
  module Busker
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
data/lib/busker.rb CHANGED
@@ -7,7 +7,7 @@ module Busker
7
7
  class Busker
8
8
  def initialize(opts={}, &block)
9
9
  @_ = {:routes => {}}
10
- (block.arity < 1 ? instance_eval(&block) : block.call(self)) if block_given?
10
+ instance_eval(&block) if block_given?
11
11
  opts[:Port] ||= opts.delete(:port) || 8080
12
12
  opts[:DocumentRoot] ||= opts.delete(:document_root) || File.expand_path('./')
13
13
  @_[:server] = WEBrick::HTTPServer.new(opts)
@@ -16,6 +16,7 @@ module Busker
16
16
  rs.status, rs.content_type, method = nil, 'text/html', rq.request_method.tr('-', '_').upcase
17
17
  route, handler = @_[:routes].find{|k,v| k.first.include?(method) && k.last.match(rq.path_info)}
18
18
  params = Hash[ CGI::parse(rq.query_string||'').map{|k,v| [k.to_sym,v[0]]} + #url params
19
+ rq.query.map{|k,v| [k.to_sym, v]} + #query params
19
20
  ($~ ? $~.names.map(&:to_sym).zip($~.captures) : []) ] #dynamic route params
20
21
  rs.status, rs.body = route ? [rs.status || 200, handler[:block].call(params, rq, rs)] : [404, 'not found']
21
22
  rescue => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: busker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pachacamac