rubyhelper 0.6.0 → 0.6.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: c50db820531494030fa2a98274eb72f7f57fe28f
4
- data.tar.gz: 3ce62f101ae31ff6bda9896144bd203b0cface8c
3
+ metadata.gz: 0d76b4b20a4e69c5e38b33b1031846e20264b64d
4
+ data.tar.gz: dc95761f9d464547fc74a87535fdb49b3d28e0c1
5
5
  SHA512:
6
- metadata.gz: 3bb6a8a4a8e42680cac5e1f0673763a68cf69b709b0f6ee8d73f6154064acb8baa86ac74f7910a3e27f569dacad77378298f3f663e016301d002a2e05d1e7652
7
- data.tar.gz: 50e93914f99ebaf246e78e245130547436d959d392e3f1aa3fe437c14d8b57bd101506af5cefc7f10f4dbb739ab223027751b0b5030d4182398ff85edf602c6c
6
+ metadata.gz: abf6b854269f22dd377a2e3954fb7568bb94a6409d69abd2762be1976fa2b582817e4c5f02bd8a3f64694bb81bc863efca25428b670aefbc9531f89c63e8bc05
7
+ data.tar.gz: ef32a328e8fa126d8827b076ed015d460f6edcb4909b09a67639ed888d81f9cfa4b52b4b66a6ec8bfaca78ae007dbeec0fa0ac49894457722641562e605dd28b
@@ -89,13 +89,16 @@ module StringHelper
89
89
  # Get a str with a static length.
90
90
  # If the str size > n, reduce the str (keep str from the (param place) )
91
91
  # You should check the test files for examples
92
- # ==Param
92
+ # == Params
93
93
  # n: number of char
94
94
  # char: char to replace if the initial str is too short
95
95
  # place: :begin/:front :end/:back :center/:middle
96
+ # == Errors
97
+ # ArgumentError : if n in not an integer/char a String
96
98
  def static(n, char=' ', place= :back)
97
- char = char.to_s
98
- n = n.to_i
99
+ raise ArgumentError, 'char is not an Char (String)' unless char.is_a? String and char[0] != nil
100
+ raise ArgumentError, 'n is not an Integer' unless n.is_a? Integer
101
+ char = char[0] # get onlu tje first char
99
102
  if size < n
100
103
  case place
101
104
  when :begin, :front
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyhelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - poulet_a
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-30 00:00:00.000000000 Z
11
+ date: 2014-08-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A list of utils for the basic Class of ruby.
14
14
  email: