muflax 0.2.6 → 0.3.0
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 +0 -0
- data/Gemfile.lock +15 -27
- data/lib/muflax/align.rb +93 -0
- data/lib/muflax/array.rb +0 -42
- data/lib/muflax/blank.rb +35 -0
- data/lib/muflax/deep_dup.rb +45 -0
- data/lib/muflax/enumerable.rb +8 -18
- data/lib/muflax/hash.rb +23 -3
- data/lib/muflax/num.rb +18 -0
- data/lib/muflax/objects.rb +0 -9
- data/lib/muflax/string.rb +26 -10
- data/lib/muflax/time.rb +27 -0
- data/lib/muflax.rb +1 -7
- data/muflax.gemspec +9 -10
- data.tar.gz.sig +0 -0
- metadata +36 -46
- metadata.gz.sig +0 -0
- data/lib/muflax/value.rb +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d2d620d2f69caa509e922b2c1fdf3309eadc76
|
4
|
+
data.tar.gz: 92e5e16239a369ee0b87c441a1b79b723726166f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 643af95c9dacc821dd77c9e855cbc05d4d19dc29334e8730f693a435519e304638cde19acce924933d6621acffc4b5078c7fcbeed1e083bed7096160777bd431
|
7
|
+
data.tar.gz: ef35033211061df3df0fac64d3bc1f9c91aef961e73c1e95dae40e07556584fd0d5cdcf915f902b24e9c02f5e00549bbf71c61a896420364dd3a5048b027b25e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/Gemfile.lock
CHANGED
@@ -1,49 +1,37 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
muflax (0.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
trollop
|
4
|
+
muflax (0.3.0)
|
5
|
+
awesome_print (~> 1)
|
6
|
+
debug_inspector (~> 0.0)
|
7
|
+
highline (~> 1.6)
|
8
|
+
pry (~> 0.10)
|
9
|
+
range_math (~> 1)
|
10
|
+
trollop (~> 2)
|
12
11
|
|
13
12
|
GEM
|
14
13
|
remote: https://rubygems.org/
|
15
14
|
specs:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
tzinfo (~> 1.1)
|
21
|
-
awesome_print (1.7.0)
|
22
|
-
coderay (1.1.1)
|
23
|
-
concurrent-ruby (1.0.2)
|
24
|
-
debug_inspector (0.0.2)
|
25
|
-
highline (1.7.8)
|
26
|
-
i18n (0.7.0)
|
15
|
+
awesome_print (1.8.0)
|
16
|
+
coderay (1.1.2)
|
17
|
+
debug_inspector (0.0.3)
|
18
|
+
highline (1.6.21)
|
27
19
|
method_source (0.8.2)
|
28
|
-
minitest (5.9.0)
|
29
20
|
pry (0.10.4)
|
30
21
|
coderay (~> 1.1.0)
|
31
22
|
method_source (~> 0.8.1)
|
32
23
|
slop (~> 3.4)
|
33
|
-
rake (
|
34
|
-
range_math (0.
|
24
|
+
rake (12.3.0)
|
25
|
+
range_math (1.0.1)
|
35
26
|
slop (3.6.0)
|
36
|
-
thread_safe (0.3.5)
|
37
27
|
trollop (2.1.2)
|
38
|
-
tzinfo (1.2.2)
|
39
|
-
thread_safe (~> 0.1)
|
40
28
|
|
41
29
|
PLATFORMS
|
42
30
|
ruby
|
43
31
|
|
44
32
|
DEPENDENCIES
|
45
33
|
muflax!
|
46
|
-
rake
|
34
|
+
rake (~> 12)
|
47
35
|
|
48
36
|
BUNDLED WITH
|
49
|
-
1.
|
37
|
+
1.14.1
|
data/lib/muflax/align.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
|
+
# License: GNU APGLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
+
|
6
|
+
module Enumerable
|
7
|
+
# find shortest element
|
8
|
+
def shortest
|
9
|
+
self.min_by{|s| s.str_length}
|
10
|
+
end
|
11
|
+
|
12
|
+
# find longest element
|
13
|
+
def longest
|
14
|
+
self.max_by{|s| s.str_length}
|
15
|
+
end
|
16
|
+
|
17
|
+
def length_of_longest
|
18
|
+
self.longest.str_length
|
19
|
+
end
|
20
|
+
|
21
|
+
def length_of_shortest
|
22
|
+
self.shortest.str_length
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Object
|
27
|
+
# consistent string length
|
28
|
+
def str_length
|
29
|
+
s = self.to_s
|
30
|
+
ss = StringScanner.new(s)
|
31
|
+
len = s.length
|
32
|
+
|
33
|
+
len -= ss.matched_size while ss.skip_until(String::ANSIColorRegexp)
|
34
|
+
|
35
|
+
len
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Array
|
40
|
+
def align str=" ", alignment: :left
|
41
|
+
just_function = case alignment
|
42
|
+
when :left ; :ljust
|
43
|
+
when :right ; :rjust
|
44
|
+
when :center ; :center
|
45
|
+
else
|
46
|
+
raise "invalid alignment: #{alignment}"
|
47
|
+
end
|
48
|
+
|
49
|
+
# split all lines
|
50
|
+
lines = []
|
51
|
+
columns = 0
|
52
|
+
|
53
|
+
self.each do |line|
|
54
|
+
line = line.split(str, -1)
|
55
|
+
lines << line
|
56
|
+
columns = [columns, line.size].max
|
57
|
+
end
|
58
|
+
|
59
|
+
# justify all columns
|
60
|
+
lengths = columns.times.map do |column|
|
61
|
+
lines.reduce(0){|sum, line| [line[column].str_length, sum].max}
|
62
|
+
end
|
63
|
+
|
64
|
+
lines.map! do |line|
|
65
|
+
# align columns
|
66
|
+
line.map!.with_index do |elem, column|
|
67
|
+
# how much the element is internally longer than it appears
|
68
|
+
elem_diff = elem.to_s.length - elem.str_length
|
69
|
+
|
70
|
+
elem.send(just_function, lengths[column] + elem_diff)
|
71
|
+
end
|
72
|
+
|
73
|
+
# join line back together
|
74
|
+
line.join(str)
|
75
|
+
end
|
76
|
+
|
77
|
+
lines
|
78
|
+
end
|
79
|
+
|
80
|
+
def align! str=" ", alignment: :left
|
81
|
+
self.replace(self.align(str, alignment: alignment))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class String
|
86
|
+
def align str=" ", alignment: :left
|
87
|
+
self.split("\n").align(str, alignment: alignment).join("\n")
|
88
|
+
end
|
89
|
+
|
90
|
+
def align! str=" ", alignment: :left
|
91
|
+
self.replace(self.align(str, aligment: alignment))
|
92
|
+
end
|
93
|
+
end
|
data/lib/muflax/array.rb
CHANGED
@@ -4,48 +4,6 @@
|
|
4
4
|
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>
|
5
5
|
|
6
6
|
class Array
|
7
|
-
def align str=" ", alignment: :left
|
8
|
-
lines = []
|
9
|
-
columns = 0
|
10
|
-
|
11
|
-
# split all lines
|
12
|
-
self.each do |line|
|
13
|
-
line = line.split(str, -1)
|
14
|
-
lines << line
|
15
|
-
columns = [columns, line.size - 1].max
|
16
|
-
end
|
17
|
-
|
18
|
-
just_function = case alignment
|
19
|
-
when :left ; :ljust
|
20
|
-
when :right ; :rjust
|
21
|
-
when :center ; :center
|
22
|
-
else
|
23
|
-
raise "invalid alignment: #{alignment}"
|
24
|
-
end
|
25
|
-
|
26
|
-
# justify all columns
|
27
|
-
0.upto(columns).each do |column|
|
28
|
-
length = lines.map{|line| line[column]}.length_of_longest
|
29
|
-
|
30
|
-
lines.each do |line|
|
31
|
-
elem = line[column]
|
32
|
-
unless elem.nil?
|
33
|
-
# how much the element is internally longer than it appears
|
34
|
-
elem_diff = elem.to_s.length - elem.str_length
|
35
|
-
|
36
|
-
line[column] = elem.send(just_function, length + elem_diff)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# join lines back together
|
42
|
-
lines.map{|line| line.join(str)}
|
43
|
-
end
|
44
|
-
|
45
|
-
def align! str=" ", alignment: :left
|
46
|
-
self.replace(self.align(str, alignment: alignment))
|
47
|
-
end
|
48
|
-
|
49
7
|
def triangle
|
50
8
|
return to_enum(:triangle) unless block_given?
|
51
9
|
|
data/lib/muflax/blank.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
|
+
# License: GNU APGLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
+
|
6
|
+
class Object
|
7
|
+
def blank?
|
8
|
+
respond_to?(:empty?) ? !!empty? : !self
|
9
|
+
end
|
10
|
+
|
11
|
+
def present?
|
12
|
+
!blank?
|
13
|
+
end
|
14
|
+
|
15
|
+
def nil_if_blank
|
16
|
+
self.blank? ? nil : self
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class NilClass ; def blank? ; true ; end ; end
|
21
|
+
class FalseClass ; def blank? ; true ; end ; end
|
22
|
+
class TrueClass ; def blank? ; false ; end ; end
|
23
|
+
class Numeric ; def blank? ; false ; end ; end
|
24
|
+
class Time ; def blank? ; false ; end ; end
|
25
|
+
|
26
|
+
class Array ; alias_method :blank?, :empty? ; end
|
27
|
+
class Hash ; alias_method :blank?, :empty? ; end
|
28
|
+
|
29
|
+
class String
|
30
|
+
BLANK_RE = /\A[[:space:]]*\z/
|
31
|
+
|
32
|
+
def blank?
|
33
|
+
empty? || BLANK_RE.match?(self)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
|
+
# License: GNU APGLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
+
|
6
|
+
class Object
|
7
|
+
def deep_dup
|
8
|
+
duplicable? ? dup : self
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Array
|
13
|
+
def deep_dup
|
14
|
+
map(&:deep_dup)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class Hash
|
19
|
+
def deep_dup
|
20
|
+
hash = dup
|
21
|
+
each_pair do |key, value|
|
22
|
+
if key.frozen? && ::String === key
|
23
|
+
hash[key] = value.deep_dup
|
24
|
+
else
|
25
|
+
hash.delete(key)
|
26
|
+
hash[key.deep_dup] = value.deep_dup
|
27
|
+
end
|
28
|
+
end
|
29
|
+
hash
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# duplicable?
|
34
|
+
require "bigdecimal"
|
35
|
+
class Object ; def duplicable? ; true ; end ; end
|
36
|
+
class BigDecimal ; def duplicable? ; true ; end ; end
|
37
|
+
class Method ; def duplicable? ; false ; end ; end
|
38
|
+
|
39
|
+
class NilClass ; begin ; nil.dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
40
|
+
class FalseClass ; begin ; false.dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
41
|
+
class TrueClass ; begin ; true.dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
42
|
+
class Symbol ; begin ; :symbol.dup; "symbol_from_string".to_sym.dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
43
|
+
class Numeric ; begin ; 1.dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
44
|
+
class Complex ; begin ; Complex(1).dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
45
|
+
class Rational ; begin ; Rational(1).dup ; rescue TypeError ; def duplicable? ; false ; end ; end ; end
|
data/lib/muflax/enumerable.rb
CHANGED
@@ -4,24 +4,6 @@
|
|
4
4
|
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>
|
5
5
|
|
6
6
|
module Enumerable
|
7
|
-
# find shortest element
|
8
|
-
def shortest
|
9
|
-
self.min_by{|s| s.str_length}
|
10
|
-
end
|
11
|
-
|
12
|
-
# find longest element
|
13
|
-
def longest
|
14
|
-
self.max_by{|s| s.str_length}
|
15
|
-
end
|
16
|
-
|
17
|
-
def length_of_longest
|
18
|
-
self.longest.str_length
|
19
|
-
end
|
20
|
-
|
21
|
-
def length_of_shortest
|
22
|
-
self.shortest.str_length
|
23
|
-
end
|
24
|
-
|
25
7
|
def average
|
26
8
|
self.sum.to_f / self.size.to_f
|
27
9
|
end
|
@@ -65,3 +47,11 @@ module Enumerable
|
|
65
47
|
self.histogram(&block).sort_by(&:second).to_h
|
66
48
|
end
|
67
49
|
end
|
50
|
+
|
51
|
+
class Object
|
52
|
+
def in? other
|
53
|
+
other.include?(self)
|
54
|
+
rescue NoMethodError
|
55
|
+
raise ArgumentError.new("The parameter passed to #in? must respond to #include?")
|
56
|
+
end
|
57
|
+
end
|
data/lib/muflax/hash.rb
CHANGED
@@ -6,9 +6,29 @@
|
|
6
6
|
# simple auto-vivifying hash
|
7
7
|
# TODO support nested hashes
|
8
8
|
def vivaHash default=[]
|
9
|
-
hash = Hash.new
|
10
|
-
|
11
|
-
|
9
|
+
hash = if default.duplicable? ; Hash.new{|h, k| h[k] = default.dup}
|
10
|
+
else ; Hash.new{|h, k| h[k] = default}
|
11
|
+
end
|
12
12
|
|
13
13
|
hash
|
14
14
|
end
|
15
|
+
|
16
|
+
# missing methods
|
17
|
+
class Hash
|
18
|
+
def transform_keys
|
19
|
+
return enum_for(:transform_keys) { size } unless block_given?
|
20
|
+
result = {}
|
21
|
+
each_key do |key|
|
22
|
+
result[yield(key)] = self[key]
|
23
|
+
end
|
24
|
+
result
|
25
|
+
end unless method_defined? :transform_keys
|
26
|
+
|
27
|
+
def transform_keys!
|
28
|
+
return enum_for(:transform_keys!) { size } unless block_given?
|
29
|
+
keys.each do |key|
|
30
|
+
self[yield(key)] = delete(key)
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end unless method_defined? :transform_keys!
|
34
|
+
end
|
data/lib/muflax/num.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
|
+
# License: GNU APGLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
+
|
6
|
+
class Numeric
|
7
|
+
def round_into num
|
8
|
+
((self / num) / num + 1) * num
|
9
|
+
end
|
10
|
+
|
11
|
+
def round_to num
|
12
|
+
(self / num.to_f).round * num
|
13
|
+
end
|
14
|
+
|
15
|
+
def multiple_of?(number)
|
16
|
+
number != 0 ? self % number == 0 : zero?
|
17
|
+
end
|
18
|
+
end
|
data/lib/muflax/objects.rb
CHANGED
@@ -47,13 +47,4 @@ class Object
|
|
47
47
|
self.respond_to? attr and other.respond_to? attr and self.send(attr) == other.send(attr)
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
51
|
-
# consistent string length
|
52
|
-
def str_length
|
53
|
-
HighLine.uncolor(self.to_s).length
|
54
|
-
end
|
55
|
-
|
56
|
-
def nil_if_blank
|
57
|
-
self.blank? ? nil : self
|
58
|
-
end
|
59
50
|
end
|
data/lib/muflax/string.rb
CHANGED
@@ -4,16 +4,8 @@
|
|
4
4
|
# License: GNU GPL 3 <http://www.gnu.org/copyleft/gpl.html>
|
5
5
|
|
6
6
|
class String
|
7
|
-
alias :starts_with?
|
8
|
-
alias :ends_with?
|
9
|
-
|
10
|
-
def align str=" ", alignment: :left
|
11
|
-
self.split("\n").align(str, alignment: alignment).join("\n")
|
12
|
-
end
|
13
|
-
|
14
|
-
def align! str=" ", alignment: :left
|
15
|
-
self.replace(self.align(str, aligment: alignment))
|
16
|
-
end
|
7
|
+
alias :starts_with? :start_with?
|
8
|
+
alias :ends_with? :end_with?
|
17
9
|
|
18
10
|
def whackuum str=/\s+/
|
19
11
|
self.split(str).map(&:strip)
|
@@ -46,4 +38,28 @@ class String
|
|
46
38
|
|
47
39
|
out
|
48
40
|
end
|
41
|
+
|
42
|
+
def first limit=1
|
43
|
+
if limit == 0 ; ""
|
44
|
+
elsif limit >= size ; dup
|
45
|
+
else ; self[0..(limit - 1)]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def last limit=1
|
50
|
+
if limit == 0 ; ""
|
51
|
+
elsif limit >= size ; dup
|
52
|
+
else ; self[(-limit)..-1]
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def indent! amount, indent_string = nil, indent_empty_lines = false
|
57
|
+
indent_string = indent_string || self[/^[ \t]/] || " "
|
58
|
+
re = indent_empty_lines ? /^/ : /^(?!$)/
|
59
|
+
gsub!(re, indent_string * amount)
|
60
|
+
end
|
61
|
+
|
62
|
+
def indent amount, indent_string = nil, indent_empty_lines = false
|
63
|
+
dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) }
|
64
|
+
end
|
49
65
|
end
|
data/lib/muflax/time.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
# Copyright Steffi Dorn <mail@muflax.com>, 2017
|
4
|
+
# License: GNU APGLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
+
|
6
|
+
class Numeric
|
7
|
+
def milliseconds ; self.seconds / 1000.0 ; end
|
8
|
+
def seconds ; self ; end
|
9
|
+
def minutes ; self.seconds * 60 ; end
|
10
|
+
def hours ; self.minutes * 60 ; end
|
11
|
+
def days ; self.hours * 24 ; end
|
12
|
+
def weeks ; self.days * 7 ; end
|
13
|
+
def fortnights ; self.weeks * 2 ; end
|
14
|
+
def months ; self.days * 30 ; end
|
15
|
+
def years ; self.days * 365 ; end
|
16
|
+
|
17
|
+
# singular usage
|
18
|
+
alias :millisecond :milliseconds
|
19
|
+
alias :second :seconds
|
20
|
+
alias :minute :minutes
|
21
|
+
alias :hour :hours
|
22
|
+
alias :day :days
|
23
|
+
alias :week :weeks
|
24
|
+
alias :fortnight :fortnights
|
25
|
+
alias :month :months
|
26
|
+
alias :year :years
|
27
|
+
end
|
data/lib/muflax.rb
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
require "csv"
|
8
8
|
require "date"
|
9
9
|
require "fileutils"
|
10
|
+
require "json"
|
10
11
|
require "set"
|
11
12
|
require "yaml"
|
12
13
|
require "zlib"
|
@@ -17,13 +18,6 @@ require "highline/import"
|
|
17
18
|
require "range_math"
|
18
19
|
require "trollop"
|
19
20
|
|
20
|
-
# rails
|
21
|
-
require "active_support"
|
22
|
-
require "active_support/all"
|
23
|
-
|
24
|
-
# avoid rails deprecation warning
|
25
|
-
I18n.enforce_available_locales = false
|
26
|
-
|
27
21
|
def require_local_libs path, location=__FILE__
|
28
22
|
Dir["#{File.join(File.dirname(location), path)}/*.rb"].each do |lib|
|
29
23
|
require lib
|
data/muflax.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "muflax"
|
3
|
-
s.version = "0.
|
3
|
+
s.version = "0.3.0"
|
4
4
|
|
5
5
|
s.authors = ["muflax"]
|
6
6
|
s.summary = "muflax standard library"
|
7
7
|
s.description = "collection of stuff muflax always uses in scripts"
|
8
8
|
s.email = "mail@muflax.com"
|
9
|
-
s.license = "
|
9
|
+
s.license = "AGPL-3.0+"
|
10
10
|
s.extra_rdoc_files = [
|
11
11
|
"README"
|
12
12
|
]
|
@@ -14,13 +14,12 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = "http://github.com/muflax/ruby-muflax"
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
|
17
|
-
s.add_dependency "
|
18
|
-
s.add_dependency "
|
19
|
-
s.add_dependency "
|
20
|
-
s.add_dependency "
|
21
|
-
s.add_dependency "
|
22
|
-
s.add_dependency "
|
23
|
-
s.add_dependency "trollop"
|
17
|
+
s.add_dependency "awesome_print", "~> 1"
|
18
|
+
s.add_dependency "debug_inspector", "~> 0.0"
|
19
|
+
s.add_dependency "highline", "~> 1.6"
|
20
|
+
s.add_dependency "pry", "~> 0.10"
|
21
|
+
s.add_dependency "range_math", "~> 1"
|
22
|
+
s.add_dependency "trollop", "~> 2"
|
24
23
|
|
25
|
-
s.add_development_dependency "rake"
|
24
|
+
s.add_development_dependency "rake", "~> 12"
|
26
25
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muflax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- muflax
|
@@ -28,120 +28,106 @@ cert_chain:
|
|
28
28
|
9xjevPGDZ+8y8wc8/mXBPK1pTaBh2oi8947HaTq8EadxezFs2Je+oSnMbygfo/a7
|
29
29
|
0rbAHpJPtzql3a4+gjK54qkJUWSUjWuLMHFIHhMt1laowNJUio6ASGx8tfzgLLnZ
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2017-
|
31
|
+
date: 2017-11-22 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: awesome_print
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '1'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: awesome_print
|
49
|
-
requirement: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version: '0'
|
46
|
+
version: '1'
|
61
47
|
- !ruby/object:Gem::Dependency
|
62
48
|
name: debug_inspector
|
63
49
|
requirement: !ruby/object:Gem::Requirement
|
64
50
|
requirements:
|
65
|
-
- - "
|
51
|
+
- - "~>"
|
66
52
|
- !ruby/object:Gem::Version
|
67
|
-
version: '0'
|
53
|
+
version: '0.0'
|
68
54
|
type: :runtime
|
69
55
|
prerelease: false
|
70
56
|
version_requirements: !ruby/object:Gem::Requirement
|
71
57
|
requirements:
|
72
|
-
- - "
|
58
|
+
- - "~>"
|
73
59
|
- !ruby/object:Gem::Version
|
74
|
-
version: '0'
|
60
|
+
version: '0.0'
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
62
|
name: highline
|
77
63
|
requirement: !ruby/object:Gem::Requirement
|
78
64
|
requirements:
|
79
|
-
- - "
|
65
|
+
- - "~>"
|
80
66
|
- !ruby/object:Gem::Version
|
81
|
-
version: '
|
67
|
+
version: '1.6'
|
82
68
|
type: :runtime
|
83
69
|
prerelease: false
|
84
70
|
version_requirements: !ruby/object:Gem::Requirement
|
85
71
|
requirements:
|
86
|
-
- - "
|
72
|
+
- - "~>"
|
87
73
|
- !ruby/object:Gem::Version
|
88
|
-
version: '
|
74
|
+
version: '1.6'
|
89
75
|
- !ruby/object:Gem::Dependency
|
90
76
|
name: pry
|
91
77
|
requirement: !ruby/object:Gem::Requirement
|
92
78
|
requirements:
|
93
|
-
- - "
|
79
|
+
- - "~>"
|
94
80
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0'
|
81
|
+
version: '0.10'
|
96
82
|
type: :runtime
|
97
83
|
prerelease: false
|
98
84
|
version_requirements: !ruby/object:Gem::Requirement
|
99
85
|
requirements:
|
100
|
-
- - "
|
86
|
+
- - "~>"
|
101
87
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0'
|
88
|
+
version: '0.10'
|
103
89
|
- !ruby/object:Gem::Dependency
|
104
90
|
name: range_math
|
105
91
|
requirement: !ruby/object:Gem::Requirement
|
106
92
|
requirements:
|
107
|
-
- - "
|
93
|
+
- - "~>"
|
108
94
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
95
|
+
version: '1'
|
110
96
|
type: :runtime
|
111
97
|
prerelease: false
|
112
98
|
version_requirements: !ruby/object:Gem::Requirement
|
113
99
|
requirements:
|
114
|
-
- - "
|
100
|
+
- - "~>"
|
115
101
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
102
|
+
version: '1'
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
104
|
name: trollop
|
119
105
|
requirement: !ruby/object:Gem::Requirement
|
120
106
|
requirements:
|
121
|
-
- - "
|
107
|
+
- - "~>"
|
122
108
|
- !ruby/object:Gem::Version
|
123
|
-
version: '
|
109
|
+
version: '2'
|
124
110
|
type: :runtime
|
125
111
|
prerelease: false
|
126
112
|
version_requirements: !ruby/object:Gem::Requirement
|
127
113
|
requirements:
|
128
|
-
- - "
|
114
|
+
- - "~>"
|
129
115
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
116
|
+
version: '2'
|
131
117
|
- !ruby/object:Gem::Dependency
|
132
118
|
name: rake
|
133
119
|
requirement: !ruby/object:Gem::Requirement
|
134
120
|
requirements:
|
135
|
-
- - "
|
121
|
+
- - "~>"
|
136
122
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
123
|
+
version: '12'
|
138
124
|
type: :development
|
139
125
|
prerelease: false
|
140
126
|
version_requirements: !ruby/object:Gem::Requirement
|
141
127
|
requirements:
|
142
|
-
- - "
|
128
|
+
- - "~>"
|
143
129
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
130
|
+
version: '12'
|
145
131
|
description: collection of stuff muflax always uses in scripts
|
146
132
|
email: mail@muflax.com
|
147
133
|
executables: []
|
@@ -156,24 +142,28 @@ files:
|
|
156
142
|
- README
|
157
143
|
- Rakefile
|
158
144
|
- lib/muflax.rb
|
145
|
+
- lib/muflax/align.rb
|
159
146
|
- lib/muflax/array.rb
|
147
|
+
- lib/muflax/blank.rb
|
160
148
|
- lib/muflax/debug.rb
|
149
|
+
- lib/muflax/deep_dup.rb
|
161
150
|
- lib/muflax/dir.rb
|
162
151
|
- lib/muflax/enumerable.rb
|
163
152
|
- lib/muflax/file.rb
|
164
153
|
- lib/muflax/hash.rb
|
165
154
|
- lib/muflax/kernel.rb
|
166
155
|
- lib/muflax/library.rb
|
156
|
+
- lib/muflax/num.rb
|
167
157
|
- lib/muflax/objects.rb
|
168
158
|
- lib/muflax/panes.rb
|
169
159
|
- lib/muflax/regex.rb
|
170
160
|
- lib/muflax/string.rb
|
171
161
|
- lib/muflax/table.rb
|
172
|
-
- lib/muflax/
|
162
|
+
- lib/muflax/time.rb
|
173
163
|
- muflax.gemspec
|
174
164
|
homepage: http://github.com/muflax/ruby-muflax
|
175
165
|
licenses:
|
176
|
-
-
|
166
|
+
- AGPL-3.0+
|
177
167
|
metadata: {}
|
178
168
|
post_install_message:
|
179
169
|
rdoc_options: []
|
@@ -191,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
181
|
version: '0'
|
192
182
|
requirements: []
|
193
183
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.6.
|
184
|
+
rubygems_version: 2.6.14
|
195
185
|
signing_key:
|
196
186
|
specification_version: 4
|
197
187
|
summary: muflax standard library
|
metadata.gz.sig
CHANGED
Binary file
|
data/lib/muflax/value.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- encoding: utf-8 -*-
|
3
|
-
# Copyright Steffi Dorn <mail@muflax.com>, 2016
|
4
|
-
# License: GNU GPLv3 (or later) <http://www.gnu.org/copyleft/gpl.html>
|
5
|
-
|
6
|
-
class Value
|
7
|
-
def ==(other)
|
8
|
-
self.class == other.class && differences_with(other).empty?
|
9
|
-
end
|
10
|
-
alias :eql? :==
|
11
|
-
|
12
|
-
def inspect
|
13
|
-
"#<#{self.class.name} #{to_h}>"
|
14
|
-
end
|
15
|
-
|
16
|
-
def hash
|
17
|
-
to_a.hash
|
18
|
-
end
|
19
|
-
|
20
|
-
def to_h
|
21
|
-
Hash[to_a]
|
22
|
-
end
|
23
|
-
|
24
|
-
def recursive_to_h
|
25
|
-
Hash[to_a.map{|k, v| [k, Value.coerce_to_h(v)]}]
|
26
|
-
end
|
27
|
-
|
28
|
-
def to_a
|
29
|
-
self.class.attributes.map {|attr| [attr, send(attr)] }
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.coerce_to_h(v)
|
33
|
-
case
|
34
|
-
when v.is_a?(Hash) ; Hash[v.map{|hk, hv| [hk, coerce_to_h(hv)]}]
|
35
|
-
when v.respond_to?(:map) ; v.map{|x| coerce_to_h(x)}
|
36
|
-
when v && v.respond_to?(:to_h) ; v.to_h
|
37
|
-
else ; v
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|