libsessho 1.5 → 1.6
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/src/libsessho.rb +8 -40
- 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: 0b9b406aea34406190da7d06f9523971121ebdc0
|
|
4
|
+
data.tar.gz: 20e7f9d83d8a59749aa63523f8116fc5d95e03a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 529c68b0c5f64a2abb3c9a4ea5c8976cacda062941c0b9958e230755a36d413244e08c43a19fef428d4918e6fcbc4bde1cc4076ee5d1ed446ec87538f0009fb3
|
|
7
|
+
data.tar.gz: 64c3e07aaf61c8144fca7a7e37fb5d6ee474da5e04fdb28ab60612a51a679837cbc8dbe213a687b6eac231d191fe71fef40741160843183b3958813510bddc17
|
data/src/libsessho.rb
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
# META_VERSION 1.5
|
|
2
|
-
|
|
3
1
|
# This program is free software; you can redistribute it and/or
|
|
4
2
|
# modify it under the terms of the GNU General Public License,
|
|
5
|
-
# version
|
|
3
|
+
# version 3, as published by the Free Software Foundation.
|
|
6
4
|
#
|
|
7
5
|
# This program is distributed in the hope that it will be
|
|
8
6
|
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
@@ -12,43 +10,7 @@
|
|
|
12
10
|
# You should have received a copy of the GNU General Public
|
|
13
11
|
# License along with this program; if not, write to the Free
|
|
14
12
|
# Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
15
|
-
# Boston, MA 02111-1307 USA.
|
|
16
|
-
|
|
17
|
-
=begin
|
|
18
|
-
class Version
|
|
19
|
-
def initialize(_1,_2=0,_3=0,_4=0)
|
|
20
|
-
@verstr = [_1,_2,_3,_4].map(&:to_s)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
=end
|
|
24
|
-
|
|
25
|
-
def upd_check
|
|
26
|
-
require 'net/http'
|
|
27
|
-
require 'timeout'
|
|
28
|
-
onln_content = nil
|
|
29
|
-
begin
|
|
30
|
-
Timeout.timeout(2) { onln_content = Net::HTTP.get(URI("https://raw.githubusercontent.com/sesshomariu/libsessho/master/libsessho.rb")) }
|
|
31
|
-
rescue
|
|
32
|
-
return [false,""]
|
|
33
|
-
else
|
|
34
|
-
onln_version = onln_content.match(/META_VERSION \d+\.\d+/).to_s.split[-1].to_f
|
|
35
|
-
this_version = File.read(__FILE__).match(/META_VERSION \d+\.\d+/).to_s.split[-1].to_f
|
|
36
|
-
upd_av = (onln_version>this_version)
|
|
37
|
-
return [upd_av, (upd_av ? onln_content : "")]
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
$0==__FILE__&&( # not imported
|
|
42
|
-
upd_av, onln_cont = upd_check
|
|
43
|
-
upd_av ? puts("Update available. Updating...") : puts("No update available(or could not check repository).")
|
|
44
|
-
upd_av&&File.write(__FILE__,onln_cont)
|
|
45
|
-
exit
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
_UPD_upd_av, _UPD_onln_cont = upd_check
|
|
49
|
-
at_exit{_UPD_upd_av&&File.write(__FILE__,_UPD_onl_cont)}
|
|
50
|
-
Signal.trap("INT"){exit} # ensure proper exit
|
|
51
|
-
|
|
13
|
+
# Boston, MA 02111-1307 USA.
|
|
52
14
|
|
|
53
15
|
module Libsessho # error module / api module / dunno
|
|
54
16
|
class StringNotDivideableError<StandardError;end
|
|
@@ -92,6 +54,12 @@ class String
|
|
|
92
54
|
end
|
|
93
55
|
end
|
|
94
56
|
|
|
57
|
+
class Numeric
|
|
58
|
+
def tol_eq(v2,t) # compare with tolerance
|
|
59
|
+
!(v2<self-t||v2>self+t)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
95
63
|
class Array
|
|
96
64
|
def intersect(sa);self.select{|i|sa.include?(i)};end
|
|
97
65
|
def subarr(pos)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libsessho
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.6'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- sesshomariu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-01-
|
|
11
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email:
|