rubyhelper 1.0.alpha5 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -1
- data/README.md +30 -3
- data/lib/rubyhelper/array.rb +14 -14
- data/lib/rubyhelper/gem-version.rb +1 -2
- data/lib/rubyhelper/hash.rb +1 -0
- data/lib/rubyhelper/numeric.rb +8 -8
- data/lib/rubyhelper/versionhelper.rb +5 -4
- data/rubyhelper.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +5 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c4d2809b4dda8c8b540cf6b28af9da23d2c57ee
|
4
|
+
data.tar.gz: 96df84faa2992e584bf94b9319c1407d5f3f7a30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06c5760573007230d36e172ae138704c353b6752df955134a7fe7f8cdb133846c28ec50a875624b247e9c1e28a560477f046014baaa4492406237569f9f3a88
|
7
|
+
data.tar.gz: 215fa6f0575db0c7083b3165b8b143ceb243eac4354eec4a73db42d975670c4b2903bc3f9116f8a1741f9d5a9bcbc9032bf261aa0c2be603ac9e52c6a79aa37a
|
checksums.yaml.gz.sig
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
s`�Z��L��e4]U ~Q�1)���E=��HQх�'��/�=�7D��K���),A��8)�2XDJK���J�J�Z|�Ģ]�P��G-�J��j�˳jú�b�9��e�gq�cj�=��G�-!�`�n�r��ٲ��=
|
2
|
+
��hg���G�AfR�e�jL��:��%�P4��KdU�W<���
|
data/README.md
CHANGED
@@ -5,10 +5,23 @@ Dev [![GitHub version](https://badge.fury.io/gh/pouleta%2Frubyhelper.svg)](http:
|
|
5
5
|
|
6
6
|
You can see the documentation here : https://www.omniref.com/ruby/gems/rubyhelper
|
7
7
|
|
8
|
+
## How is it works ?
|
9
|
+
See the [wtf] section too know what is exactly this stuff.
|
10
|
+
Too use the gem, install it :
|
11
|
+
```
|
12
|
+
$ gem install rubyhelper # install the last stable version
|
13
|
+
```
|
14
|
+
|
15
|
+
To use it in your ruby project, use
|
16
|
+
```
|
17
|
+
require 'rubyhelper'
|
18
|
+
```
|
19
|
+
|
8
20
|
## Wtf ?
|
9
21
|
This gem is my own creation. It is a compilation of shortcuts, improvement,
|
10
22
|
helpers about the basic classes, String, Array, ... to make your work easier.
|
11
|
-
I hope too help you with this gem.
|
23
|
+
I hope too help you with this gem. I put also few lines from stackoverflow etc.
|
24
|
+
in this gem ;)
|
12
25
|
|
13
26
|
|
14
27
|
## My favorites functions from this gem
|
@@ -23,7 +36,22 @@ I hope too help you with this gem.
|
|
23
36
|
|
24
37
|
|
25
38
|
## Notes about the source code
|
26
|
-
The following sources code is not only my stuff, but also an implementation of
|
39
|
+
The following sources code is not only my stuff, but also an implementation of
|
40
|
+
idea found on stackoverflow, ...
|
41
|
+
|
42
|
+
The developpement running like that :
|
43
|
+
1. Found idea
|
44
|
+
2. Put it in the gem
|
45
|
+
3. Developpe few tests
|
46
|
+
4. Push it in a unstable gem (like v1.0.alpha1)
|
47
|
+
5. **repeat 1-4 actions few times**
|
48
|
+
6. Improve tests
|
49
|
+
7. Validate the version
|
50
|
+
8. Push new "stable" version (like v1.1)
|
51
|
+
|
52
|
+
Note about the first time developpement :
|
53
|
+
I didn't predict to keep this gem in dev so the first part of the dev
|
54
|
+
is a little messy. Don't look back 1.1 ;)
|
27
55
|
|
28
56
|
|
29
57
|
# TODO
|
@@ -39,4 +67,3 @@ The following sources code is not only my stuff, but also an implementation of i
|
|
39
67
|
- poulet_a : Creator and main developper. Feel free to ask me a question by email.
|
40
68
|
email : arthur.poulet AT cryptolab.net
|
41
69
|
OpenPGP : 0x6D9EA34A
|
42
|
-
|
data/lib/rubyhelper/array.rb
CHANGED
@@ -5,12 +5,12 @@ module ArrayHelper
|
|
5
5
|
# This function return a pretty good string. Like join but with an array
|
6
6
|
# You can use an array as separator : [",", " "] will successively ',' and ' '
|
7
7
|
# Exemple : ["a", "b", "c"].joini(["x", "y"]) => "axbyc"
|
8
|
-
# == Errors
|
9
|
-
# ArgumentError : if sep in not an array
|
10
|
-
# == Params
|
11
|
-
# sep: (Array) array of separator
|
12
|
-
# == Returns
|
13
|
-
# str: (String) string joined
|
8
|
+
# == Errors:
|
9
|
+
# - ArgumentError : if sep in not an array
|
10
|
+
# == Params:
|
11
|
+
# - sep: (Array) array of separator
|
12
|
+
# == Returns:
|
13
|
+
# - str: (String) string joined
|
14
14
|
def joini sep
|
15
15
|
raise ArgumentError, 'Argument is not an array' unless sep.is_a? Array
|
16
16
|
str = String.new
|
@@ -45,10 +45,10 @@ module ArrayHelper
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# get the n higher values of the array
|
48
|
-
# == Errors
|
49
|
-
# ArgumentError : if n in not an integer
|
50
|
-
# == Params
|
51
|
-
# n: (Integer) number of elements
|
48
|
+
# == Errors:
|
49
|
+
# - ArgumentError : if n in not an integer
|
50
|
+
# == Params:
|
51
|
+
# - n: (Integer) number of elements
|
52
52
|
def maxs(n=1)
|
53
53
|
raise ArgumentError, 'Argument is not an integer' unless n.is_a? Integer
|
54
54
|
n = 1 if n < 1
|
@@ -57,10 +57,10 @@ module ArrayHelper
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# get the n lower values of the array
|
60
|
-
# == Errors
|
61
|
-
# ArgumentError : if n in not an integer
|
62
|
-
# == Params
|
63
|
-
# n: (Integer) number of elements
|
60
|
+
# == Errors:
|
61
|
+
# - ArgumentError : if n in not an integer
|
62
|
+
# == Params:
|
63
|
+
# - n: (Integer) number of elements
|
64
64
|
def mins(n=1)
|
65
65
|
raise ArgumentError, 'Argument is not an integer' unless n.is_a? Integer
|
66
66
|
n = 1 if n < 1
|
data/lib/rubyhelper/hash.rb
CHANGED
data/lib/rubyhelper/numeric.rb
CHANGED
@@ -8,10 +8,10 @@ module NumericHelper
|
|
8
8
|
return (self < 0) ? ("-") : ("+")
|
9
9
|
end
|
10
10
|
|
11
|
-
# Errors
|
12
|
-
# ArgumentError : if the passed value is not an integer
|
13
|
-
# Returns
|
14
|
-
# value: (Numeric) self if self >= min else min
|
11
|
+
# == Errors:
|
12
|
+
# - ArgumentError : if the passed value is not an integer
|
13
|
+
# == Returns:
|
14
|
+
# - value: (Numeric) self if self >= min else min
|
15
15
|
def min(minimum_value)
|
16
16
|
raise ArgumentError unless minimum_value.is_a? Numeric
|
17
17
|
return self >= minimum_value ? self : minimum_value
|
@@ -20,10 +20,10 @@ module NumericHelper
|
|
20
20
|
return self.replace(self.min(minimum_value))
|
21
21
|
end
|
22
22
|
|
23
|
-
# Errors
|
24
|
-
# ArgumentError : if the passed value is not an integer
|
25
|
-
# Returns
|
26
|
-
# value: (Numeric) self if self <= max else max
|
23
|
+
# == Errors:
|
24
|
+
# - ArgumentError : if the passed value is not an integer
|
25
|
+
# == Returns:
|
26
|
+
# - value: (Numeric) self if self <= max else max
|
27
27
|
def max(maximum_value)
|
28
28
|
raise ArgumentError unless maximum_value.is_a? Numeric
|
29
29
|
return self <= maximum_value ? self : maximum_value
|
@@ -9,7 +9,7 @@ module VersionHelper
|
|
9
9
|
attr_accessor :v
|
10
10
|
|
11
11
|
# == Params:
|
12
|
-
# arg : list of arguments
|
12
|
+
# - arg : list of arguments
|
13
13
|
# Integer : 1234 => 1.2.3.4
|
14
14
|
# String : "1.2-3" => 1.2.3
|
15
15
|
# Array : like multiple arguments
|
@@ -58,6 +58,7 @@ module VersionHelper
|
|
58
58
|
return Version.to_s(self)
|
59
59
|
end
|
60
60
|
|
61
|
+
# Not work yet
|
61
62
|
def to_h
|
62
63
|
return Version.to_h(self)
|
63
64
|
end
|
@@ -71,19 +72,19 @@ module VersionHelper
|
|
71
72
|
raise ArgumentError unless version.is_a? Version
|
72
73
|
return version.v.dup
|
73
74
|
end
|
74
|
-
|
75
|
+
|
75
76
|
#Return an string with each number of the version, joined by '.'
|
76
77
|
def self.to_s(version)
|
77
78
|
raise ArgumentError unless version.is_a? Version
|
78
79
|
return version.v.join('.')
|
79
80
|
end
|
80
81
|
|
81
|
-
#Not work
|
82
|
+
#Not work yet
|
82
83
|
def self.to_h(version)
|
83
84
|
raise ArgumentError unless version.is_a? Version
|
84
85
|
return nil
|
85
86
|
end
|
86
|
-
|
87
|
+
|
87
88
|
#Return an integer with each number of the version
|
88
89
|
def self.to_i(version)
|
89
90
|
raise ArgumentError unless version.is_a? Version
|
data/rubyhelper.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'rubyhelper'
|
5
5
|
s.version = RubyHelper::VERSION
|
6
6
|
s.date = Time.now.getgm.to_s.split.first
|
7
|
-
s.summary = "
|
7
|
+
s.summary = "First real release :) 1.1 with fix doc, fix tests, certification, ..."
|
8
8
|
s.description = "A list of utils for the basic Class of ruby."
|
9
9
|
s.authors = [
|
10
10
|
"poulet_a"
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyhelper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- poulet_a
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
+lG6tRo8QaFrH3afOmy4VUaG84Jm1XjNYnyaOfLb9ItpcQgVySn2c3aJ2PLcPljM
|
32
32
|
EhZUryAiV8KNMQ==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-09-
|
34
|
+
date: 2014-09-06 00:00:00.000000000 Z
|
35
35
|
dependencies: []
|
36
36
|
description: A list of utils for the basic Class of ruby.
|
37
37
|
email:
|
@@ -87,14 +87,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
|
-
- - "
|
90
|
+
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
92
|
+
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
95
|
rubygems_version: 2.4.1
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
|
-
summary:
|
98
|
+
summary: First real release :) 1.1 with fix doc, fix tests, certification, ...
|
99
99
|
test_files: []
|
100
100
|
has_rdoc:
|
metadata.gz.sig
CHANGED
Binary file
|