epitools 0.5.134 → 0.5.137

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.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.134
4
+ version: 0.5.137
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-10-31 00:00:00.000000000 Z
10
+ date: 2026-09-15 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rspec
@@ -54,6 +53,7 @@ files:
54
53
  - lib/epitools/core_ext/argv.rb
55
54
  - lib/epitools/core_ext/array.rb
56
55
  - lib/epitools/core_ext/class.rb
56
+ - lib/epitools/core_ext/date.rb
57
57
  - lib/epitools/core_ext/enumerable.rb
58
58
  - lib/epitools/core_ext/file.rb
59
59
  - lib/epitools/core_ext/hash.rb
@@ -69,6 +69,7 @@ files:
69
69
  - lib/epitools/core_ext/truthiness.rb
70
70
  - lib/epitools/core_ext/uri.rb
71
71
  - lib/epitools/daemonize.rb
72
+ - lib/epitools/fraction.rb
72
73
  - lib/epitools/gem_ext/oga.rb
73
74
  - lib/epitools/hexdump.rb
74
75
  - lib/epitools/iter.rb
@@ -86,7 +87,6 @@ files:
86
87
  - lib/epitools/progressbar.rb
87
88
  - lib/epitools/rails.rb
88
89
  - lib/epitools/rash.rb
89
- - lib/epitools/ratio.rb
90
90
  - lib/epitools/semantic_version.rb
91
91
  - lib/epitools/slop.rb
92
92
  - lib/epitools/slop/LICENSE
@@ -105,14 +105,16 @@ files:
105
105
  - lib/epitools/wm.rb
106
106
  - spec/.rspec
107
107
  - spec/autoreq_spec.rb
108
- - spec/browser_spec.rb
109
108
  - spec/btree_spec.rb
110
109
  - spec/clitools_spec.rb
111
110
  - spec/colored_spec.rb
112
111
  - spec/core_ext_spec.rb
112
+ - spec/fraction_spec.rb
113
113
  - spec/histogram_spec.rb
114
114
  - spec/iter_spec.rb
115
115
  - spec/lcs_spec.rb
116
+ - spec/manual/browser_spec.rb
117
+ - spec/manual/wm_spec.rb
116
118
  - spec/numwords_spec.rb
117
119
  - spec/path_spec.rb
118
120
  - spec/permutations_spec.rb
@@ -122,13 +124,11 @@ files:
122
124
  - spec/sys_spec.rb
123
125
  - spec/term_spec.rb
124
126
  - spec/typed_struct_spec.rb
125
- - spec/wm_spec.rb
126
127
  - spec/zopen_spec.rb
127
128
  homepage: http://github.com/epitron/epitools
128
129
  licenses:
129
130
  - WTFPL
130
131
  metadata: {}
131
- post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -143,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  requirements: []
146
- rubygems_version: 3.2.21
147
- signing_key:
146
+ rubygems_version: 3.6.9
148
147
  specification_version: 3
149
148
  summary: Not utils... METILS!
150
149
  test_files: []
@@ -1,78 +0,0 @@
1
- #
2
- # The ratio between two numbers (eg: 2:1, 3:4)
3
- #
4
- # Can be compared, added, "percent"ed, "to_f"ed, and displayed.
5
- #
6
- class Ratio
7
-
8
- include Comparable
9
-
10
- def <=>(other)
11
- to_f <=> other.to_f
12
- end
13
-
14
- attr_accessor :first, :last
15
-
16
- def self.[](*args)
17
- new(*args)
18
- end
19
-
20
- #
21
- # `first` is the top part of the ratio, `last` is the bottom (eg: `first/last`)
22
- #
23
- def initialize(first, last=1)
24
- @first = first
25
- @last = last
26
- end
27
-
28
- #
29
- # Returns a string representation: "a/b"
30
- #
31
- def to_s
32
- "#{@first}/#{@last}"
33
- end
34
- alias_method :ratio, :to_s
35
-
36
- #
37
- # Returns the ratio as a float. (eg: Ratio[1,2].to_f == 0.5)
38
- #
39
- def to_f
40
- if @last == 0
41
- 0.0
42
- else
43
- @first.to_f / @last
44
- end
45
- end
46
-
47
- #
48
- # Returns a string representing the number in percent
49
- #
50
- def percent
51
- "%0.1f%%" % (to_f * 100)
52
- end
53
- alias_method :to_percent, :percent
54
-
55
- #
56
- # "#<Ratio: 1/2>"
57
- #
58
- def inspect
59
- "#<Ratio: #{to_s}>"
60
- end
61
-
62
- #
63
- # Adds together the tops and bottoms of the ratios.
64
- #
65
- # Example: For the ratios `a/c` and `b/d`, returns `a+b/c+d`
66
- #
67
- def +(other)
68
- Ratio.new( first+other.first, last+other.last)
69
- end
70
-
71
- end
72
-
73
- #
74
- # Function-style wrapper
75
- #
76
- def Ratio(*args)
77
- Ratio.new(*args)
78
- end
File without changes
File without changes