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 +4 -4
- data/lib/rubyhelper/stringhelper.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d76b4b20a4e69c5e38b33b1031846e20264b64d
|
4
|
+
data.tar.gz: dc95761f9d464547fc74a87535fdb49b3d28e0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
# ==
|
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
|
98
|
-
n
|
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.
|
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-
|
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:
|