cuba-contrib 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,13 +7,13 @@ class Cuba
7
7
  end
8
8
 
9
9
  def truncate(str, length, ellipses = "...")
10
- return str if str.length <= length
10
+ return str if !str || str.length <= length
11
11
 
12
12
  sprintf("%.#{length}s#{ellipses}", str)
13
13
  end
14
14
 
15
15
  def nl2br(str)
16
- str.gsub(/\n|\r\n/, "<br>")
16
+ str.to_s.gsub(/\n|\r\n/, "<br>")
17
17
  end
18
18
 
19
19
  def currency(amount, unit = "$")
@@ -32,4 +32,4 @@ class Cuba
32
32
  str.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').downcase
33
33
  end
34
34
  end
35
- end
35
+ end
@@ -1,5 +1,5 @@
1
1
  class Cuba
2
2
  module Contrib
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
data/views/field.mote CHANGED
@@ -7,7 +7,7 @@
7
7
  <em class="hint">{{ hint }}</em>
8
8
  % end
9
9
 
10
- % if error
10
+ % if not error.to_s.empty?
11
11
  <span class="error"><em>{{ error}}</em></span>
12
12
  % end
13
- </label>
13
+ </label>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuba-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-04 00:00:00.000000000Z
12
+ date: 2011-11-21 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cuba
16
- requirement: &2152469660 !ruby/object:Gem::Requirement
16
+ requirement: &2160364820 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152469660
24
+ version_requirements: *2160364820
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cutest
27
- requirement: &2152469180 !ruby/object:Gem::Requirement
27
+ requirement: &2160363780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2152469180
35
+ version_requirements: *2160363780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: capybara
38
- requirement: &2152468760 !ruby/object:Gem::Requirement
38
+ requirement: &2160362800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2152468760
46
+ version_requirements: *2160362800
47
47
  description: Includes various helper tools for Cuba.
48
48
  email:
49
49
  - me@cyrildavid.com