refined-refinements 0.0.2 → 0.0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/refined-refinements/colours.rb +28 -0
- data/lib/refined-refinements/homepath.rb +31 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dd0044dbf34c5eab4573deddaf601c538a64ab55d3fd3b287287e859dde3a4e
|
4
|
+
data.tar.gz: fd0aded35d7f7a3ea90dd2b9985c889d73190ccaf0827b4c63fc149431eb22b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4c63751677cf7dc2fde1210a123327d45305a9ad183c1f69d6015ab709ee02c1e41e80e38b1b0df2549721fe129d4ac9114c0e001c75bb30c4198619f84511
|
7
|
+
data.tar.gz: 87a4910d3e369afa95767d3d0f7bfb1d8b853edbbf0e40c7dbd823b9aa7155333c0a3246cb751678d57e4959d193d1a775ccafda7048ae0c64615083d50b7c76
|
@@ -139,6 +139,34 @@ module RR
|
|
139
139
|
@template_string.colourise
|
140
140
|
end
|
141
141
|
end
|
142
|
+
|
143
|
+
module ColouredTerminal
|
144
|
+
using ColourExts
|
145
|
+
|
146
|
+
def self.included(base)
|
147
|
+
base.class_eval do
|
148
|
+
[:puts, :print, :warn, :abort].each do |method_name|
|
149
|
+
define_method(method_name) do |*args|
|
150
|
+
Kernel.send(method_name, *args.map do |argument|
|
151
|
+
argument.is_a?(String) ? argument.colourise : argument
|
152
|
+
end)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
refine Kernel do
|
159
|
+
using ColourExts
|
160
|
+
|
161
|
+
[:puts, :print, :warn, :abort].each do |method_name|
|
162
|
+
define_method(method_name) do |*args|
|
163
|
+
Kernel.send(method_name, *args.map do |argument|
|
164
|
+
argument.is_a?(String) ? argument.colourise : argument
|
165
|
+
end)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
142
170
|
end
|
143
171
|
|
144
172
|
# using RR::ColourExts
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RR
|
2
|
+
class Homepath
|
3
|
+
def initialize(path)
|
4
|
+
if path.start_with?('~')
|
5
|
+
@path = File.expand_path(path)
|
6
|
+
else
|
7
|
+
@path = path # Can be relative.
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
@path.sub(ENV['HOME'], '~')
|
13
|
+
end
|
14
|
+
alias_method :inspect, :to_s
|
15
|
+
|
16
|
+
def expand
|
17
|
+
@path
|
18
|
+
end
|
19
|
+
|
20
|
+
def exist?
|
21
|
+
File.exist?(@path)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# FIXME: So far colours don't take arguments.
|
26
|
+
if defined?(ColourExts)
|
27
|
+
ColourExts.colours.define_singleton_method(:homepath) do |path|
|
28
|
+
HomePath.new(path).to_s
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refined-refinements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.2
|
4
|
+
version: 0.0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James C Russell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: "."
|
14
14
|
email: james@101ideas.cz
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- lib/refined-refinements/curses/colours.rb
|
27
27
|
- lib/refined-refinements/curses/commander.rb
|
28
28
|
- lib/refined-refinements/date.rb
|
29
|
+
- lib/refined-refinements/homepath.rb
|
29
30
|
- lib/refined-refinements/hour.rb
|
30
31
|
- lib/refined-refinements/matching.rb
|
31
32
|
- lib/refined-refinements/string.rb
|