lucie-lib 0.0.21 → 0.1.0

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: 6ba29b920b702de3ef30c503fd5443bdb17556b3
4
- data.tar.gz: 942edb65990bb556630bc172c1708c538143972f
3
+ metadata.gz: 80a65f6ee5a45b19bd5c771cbb51f29d457cd9d2
4
+ data.tar.gz: b800eca212e9572e9ef879597fcd1e6b1b233d0a
5
5
  SHA512:
6
- metadata.gz: 332c09f53af5787823467ef1b4c91a5b18645ba3aea03cce020c6910920e6085e68f71590214281617c8778c19a3d83fce760f97711ec69cfd2680206300c5ab
7
- data.tar.gz: 43d194c86db40c664b6b2e19f8707af182524fe7ece3b5cd5fde1c4df9c654af2a96a7a63811e59eaf0ba6a9bf84bb23a25249fc0029191e0387c6cf22534138
6
+ metadata.gz: 16490b1dabaf91a42fd7c18c666030e85525cfe7d932c36aab09be8bbeb00e777aa9f9f03fd086857b84628308ff6e513c0467999b2410d7b21ee0133574fd99
7
+ data.tar.gz: 0d81b701679534c0773baf3e2f11467109100b91185e5a5c0a7b032bc7233e31a9efab351c27de3a9a4d4676417585c68e60df14274933dbf82e0a57042a2198
data/lib/lucie.rb CHANGED
@@ -37,6 +37,10 @@ module Lucie
37
37
 
38
38
  include ::Lucie::Exceptions
39
39
 
40
+ module Helpers
41
+ autoload :ControllerName, "lucie/helpers/controller_name"
42
+ end
43
+
40
44
  module Controller
41
45
  autoload :ExitRequest, "lucie/controller/exit_request"
42
46
  end
data/lib/lucie/app.rb CHANGED
@@ -156,7 +156,7 @@ private
156
156
  filename = File.basename(path)
157
157
  controller_name = filename.split(".rb").first
158
158
  if controller_name.to_s.length > 0
159
- const_name = controller_name.split("_").map!{|x| x.capitalize!}.join
159
+ const_name = Helpers::ControllerName.new(controller_name).capitalized
160
160
 
161
161
  # place the constant to the root namespace
162
162
  Object.class_eval do
@@ -0,0 +1,18 @@
1
+ module Lucie
2
+ module Helpers
3
+ #
4
+ # Converts controller name from underscore form to capitalized
5
+ #
6
+ class ControllerName
7
+ attr_reader :name
8
+
9
+ def initialize(name)
10
+ @name = name
11
+ end
12
+
13
+ def capitalized
14
+ @name.split("_").map{|x| x.capitalize}.join
15
+ end
16
+ end
17
+ end
18
+ end
data/lib/lucie/version.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  module Lucie
2
- VERSION = "0.0.21"
2
+ unless defined?(VERSION)
3
+ VERSION = "0.1.0"
4
+ end
3
5
  end
@@ -0,0 +1,16 @@
1
+ require "test_helper"
2
+
3
+ class ControllerNameTest < MiniTest::Unit::TestCase
4
+
5
+ include Helpers
6
+
7
+ def test_controller_name_capitalizer
8
+ assert_equal "Test", ControllerName.new("test").capitalized
9
+ assert_equal "TestController", ControllerName.new("test_controller").capitalized
10
+ assert_equal "", ControllerName.new("").capitalized
11
+ end
12
+
13
+ def test_controller_name_name
14
+ assert_equal "test_controller", ControllerName.new("test_controller").name
15
+ end
16
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucie-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nucc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-08 00:00:00.000000000 Z
11
+ date: 2014-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -96,6 +96,7 @@ files:
96
96
  - lib/lucie/controller/base.rb
97
97
  - lib/lucie/controller/exit_request.rb
98
98
  - lib/lucie/exceptions.rb
99
+ - lib/lucie/helpers/controller_name.rb
99
100
  - lib/lucie/snippets/template.rb
100
101
  - lib/lucie/validators/base.rb
101
102
  - lib/lucie/validators/mandatory_option.rb
@@ -115,6 +116,7 @@ files:
115
116
  - test/unit/command_line_parser_test.rb
116
117
  - test/unit/command_line_slicer_test.rb
117
118
  - test/unit/controller/base_test.rb
119
+ - test/unit/helpers/controller_name_test.rb
118
120
  homepage: http://my.luc.ie
119
121
  licenses: []
120
122
  metadata: {}
@@ -153,3 +155,4 @@ test_files:
153
155
  - test/unit/command_line_parser_test.rb
154
156
  - test/unit/command_line_slicer_test.rb
155
157
  - test/unit/controller/base_test.rb
158
+ - test/unit/helpers/controller_name_test.rb