ki 0.4.3 → 0.4.4

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: 848983c889362ba630e00014d4b670342d59ac68
4
- data.tar.gz: a34e3829a0b471ba4f2cf3e31c7c3f0ba1a82231
3
+ metadata.gz: 0ddd8001c049b74417c89f5da05f779e705b311c
4
+ data.tar.gz: a5b2026b178aba8c7c4eac298051faa4182e55ae
5
5
  SHA512:
6
- metadata.gz: b4c33d21423505f78dd4d20afa6bae4e8c42c6dafd79325290384db94f53162d346c6087c9b3e8fa4dace49dfa13f4be41c70b6e24cc6116bb5d1756e89c2117
7
- data.tar.gz: 4c7442a2117142f8cd45a8e1c690ec6f7d42b7d7bc10cb0d96b71c8ca1fb2a6b891b12c6459f04dbb3ccb9e8c3b79e18faf94e1fbacd50d942b0b4b611a1283e
6
+ metadata.gz: 328c8df2c4df3ac20938130cd48bf27ea04036f108f1e6eecc03b0affeb77cc2d108fa1d950ea9b0fc0d0a42c4ac33976334af971838f2e81fd01f084ba38b5d
7
+ data.tar.gz: dbca108a4cd6bd95c417b954158b6267eb6104326880718132012cee449a127660d551cb678b50613176f7475da51459cf5910d9489ff23cc3b1a840c361b63a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ki (0.4.3)
4
+ ki (0.4.4)
5
5
  bson_ext
6
6
  bundler (~> 1.5)
7
7
  coffee-script
@@ -12,7 +12,7 @@ class String
12
12
  chain = self.split "::"
13
13
  klass = Kernel
14
14
  chain.each do |klass_string|
15
- klass = klass.const_get klass_string.capitalize
15
+ klass = klass.const_get klass_string.split('_').map{|w| w.capitalize}.join('')
16
16
  end
17
17
  klass.is_a?(Class) ? klass : nil
18
18
  rescue NameError
@@ -1,3 +1,3 @@
1
1
  module Ki
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
@@ -11,6 +11,8 @@ describe Ki::BaseRequest do
11
11
  it 'coverts path to class' do
12
12
  class Foo < Ki::Model; end
13
13
  class Bar < Ki::Model; end
14
+ class FooBar < Ki::Model; end
15
+
14
16
  req.new({'PATH_INFO' => ''}).to_ki_model_class.should == nil
15
17
  req.new({'PATH_INFO' => '/'}).to_ki_model_class.should == nil
16
18
  req.new({'PATH_INFO' => 'foo'}).to_ki_model_class.should == Foo
@@ -19,7 +21,9 @@ describe Ki::BaseRequest do
19
21
  req.new({'PATH_INFO' => '/bar.json'}).to_ki_model_class.should == Bar
20
22
  req.new({'PATH_INFO' => '/Foo/bar.json'}).to_ki_model_class.should == nil
21
23
  req.new({'PATH_INFO' => '/Foo/bar'}).to_ki_model_class.should == nil
22
- req.new({'PATH_INFO' => '/Foo_bar'}).to_ki_model_class.should == nil
24
+ req.new({'PATH_INFO' => '/Foo_bar'}).to_ki_model_class.should == FooBar
25
+ req.new({'PATH_INFO' => '/foo_bar'}).to_ki_model_class.should == FooBar
26
+ req.new({'PATH_INFO' => '/foo_bar.json'}).to_ki_model_class.should == FooBar
23
27
  end
24
28
 
25
29
  it 'converts verb to action' do
@@ -7,6 +7,8 @@ describe Ki do
7
7
 
8
8
  it 'should convert string to class corectly' do
9
9
  class Cez; end
10
+ class CezBar; end
10
11
  'cez'.to_class.should == Cez
12
+ 'cez_bar'.to_class.should == CezBar
11
13
  end
12
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cristian Mircea Messel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-02 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler