fprinter 0.1.1 → 0.2.0

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 CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OWNjYmMxNTY1NjMzMTVmMTU4N2I4YzhjMGJlYzRhOTIyMzVhNTU2NA==
5
- data.tar.gz: !binary |-
6
- YmJjMGExMzQwNzk5NzIxMjZiZThkYTVhM2I1ZDcyNjIwZTNhMmEyOQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MWZiYTgyNWYwYWYyMjgwNzg5Y2ZlMmQ5YzQ0ZDc1YzQ4YjhiYWEwZjIwZDZm
10
- NGZmNGU5ZmNjNDI0YTExMjg1YjUwMjU3YTc1NjlkMzM2ZjlmNzc1NjFmZmFj
11
- NjM4NTM0ZWE1OWIzM2FlYzdjOWU3ZDRkNWJmYTA1ZDA3MzAyNzA=
12
- data.tar.gz: !binary |-
13
- OGFmYzllNmQ2NjJlMmVhNDI4OWVlNjA4Y2E4NzBhODhmMTUzYzU1NTIzZTY3
14
- MDZhZGM4YTJlMWUwY2QzNzkxZWE3NmQ1MzEwMzhkYzgyMzAyZTNiMzcyODEw
15
- YmUyZDBjYjdhMTk3ZDZhZTU5ZDBmZDA1N2VmNzFhNzBlZDU3YTU=
2
+ SHA1:
3
+ metadata.gz: 9da4e9a7b080add72da8d904e31b5e399394c3b9
4
+ data.tar.gz: 799785c51dc3618adbbfa537ba16ca5dc7cc0d9e
5
+ SHA512:
6
+ metadata.gz: 55734e22147abbc197b7703e32ea64be1273866e51a3d5abbb956abe1ef007acd7df3d616bf36e4d58eff4061571170a78317e65f0418e8206fb07604c7e3e08
7
+ data.tar.gz: e787c5b649d67a085d9b949b6da435f1cc063b89baf499c2cd0444664789c0f9a147bbfe2932e11695de95f50a7ef648a456b8ea6e69fc1fce23e8b4d1bb5468
@@ -1,3 +1,3 @@
1
- require 'fprinter/display_change'
2
- require 'fprinter/printer_change'
3
- require 'fprinter/screen'
1
+ require_relative 'fprinter/display_change'
2
+ require_relative 'fprinter/printer_change'
3
+ require_relative 'fprinter/screen'
@@ -1,83 +1,39 @@
1
1
  require_relative 'screen.rb'
2
2
  module FPrinter
3
- def self.bold(str)
4
- print "\e[1m" + str + "\e[0m\n"
5
- end
6
-
7
- def self.blink(str, sec = 1)
8
- print "\e[5m" + str + "\e[0m\n"
9
- end
10
-
11
- def self.underline(str)
12
- print "\e[4m" + str + "\e[0m\n"
13
- end
14
-
15
- def self.highlight(str)
16
- print "\e[7m" + str + "\e[0m\n"
17
- end
18
-
19
- def self.black(str)
20
- print "\e[30m" + str + "\e[0m\n"
21
- end
22
-
23
- def self.red(str)
24
- print "\e[31m" + str + "\e[0m\n"
25
- end
26
-
27
- def self.green(str)
28
- print "\e[32m" + str + "\e[0m\n"
29
- end
30
-
31
- def self.yellow(str)
32
- print "\e[33m" + str + "\e[0m\n"
33
- end
34
-
35
- def self.blue(str)
36
- print "\e[34m" + str + "\e[0m\n"
37
- end
38
-
39
- def self.magenta(str)
40
- print "\e[35m" + str + "\e[0m\n"
41
- end
42
-
43
- def self.cyan(str)
44
- print "\e[36m" + str + "\e[0m\n"
45
- end
46
-
47
- def self.white(str)
48
- print "\e[37m" + str + "\e[0m\n"
49
- end
50
-
51
- def self.highlighted_black(str)
52
- print "\e[40m" + str + "\e[0m\n"
53
- end
54
-
55
- def self.highlighted_red(str)
56
- print "\e[41m" + str + "\e[0m\n"
57
- end
58
-
59
- def self.highlighted_green(str)
60
- print "\e[42m" + str + "\e[0m\n"
61
- end
62
-
63
- def self.highlighted_yellow(str)
64
- print "\e[43m" + str + "\e[0m\n"
65
- end
66
-
67
- def self.highlighted_blue(str)
68
- print "\e[44m" + str + "\e[0m\n"
69
- end
70
-
71
- def self.highlighted_magenta(str)
72
- print "\e[45m" + str + "\e[0m\n"
73
- end
74
-
75
- def self.highlighted_cyan(str)
76
- print "\e[46m" + str + "\e[0m\n"
3
+
4
+ CONSOLE_MATCHES = {
5
+ bold: "\e[1m",
6
+ blink: "\e[5m",
7
+ underline: "\e[4m" ,
8
+ highlight: "\e[7m" ,
9
+ black: "\e[30m",
10
+ red: "\e[31m",
11
+ green: "\e[32m",
12
+ yellow: "\e[33m",
13
+ blue: "\e[34m",
14
+ magenta: "\e[35m",
15
+ cyan: "\e[36m",
16
+ white: "\e[37m",
17
+ highlighted_black: "\e[40m",
18
+ highlighted_red: "\e[41m",
19
+ highlighted_green: "\e[42m",
20
+ highlighted_yellow: "\e[43m",
21
+ highlighted_blue: "\e[44m",
22
+ highlighted_magenta: "\e[45m",
23
+ highlighted_cyan: "\e[46m",
24
+ highlighted_white: "\e[47m"
25
+ }
26
+
27
+ CONSOLE_MATCHES.each do |matcher, color_code|
28
+ define_singleton_method(matcher) do |str|
29
+ print color_code + str + "\e[0m\n"
30
+ end
77
31
  end
78
-
79
- def self.highlighted_white(str)
80
- print "\e[47m" + str + "\e[0m\n"
32
+
33
+ CONSOLE_MATCHES.each do |matcher, color_code|
34
+ define_singleton_method("#{matcher}!") do
35
+ print color_code
36
+ end
81
37
  end
82
38
 
83
39
  def self.big(str)
@@ -150,13 +106,3 @@ BIG_LETTERS = { "a" => 0,
150
106
  "@" => 241,
151
107
  "A" => 251
152
108
  }
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
@@ -1,10 +1,18 @@
1
1
  module FPrinter
2
-
2
+
3
3
  def self.clean!
4
4
  print "\e[2J"
5
5
  end
6
-
7
- def self.top_left!
6
+
7
+ def self.move_to_home!
8
8
  print "\e[H"
9
9
  end
10
- end
10
+
11
+ def self.reset!
12
+ print "\e[0m\n"
13
+ end
14
+
15
+ def self.flush!
16
+ $stdout.flush
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fprinter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
- - Stephan Thomas
7
+ - Stephane Thomas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-11 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A simple printer gem, to print your stuff a fancy way
14
14
  email: thomas.stephn@gmail.com
@@ -17,32 +17,39 @@ extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
19
  - lib/fprinter.rb
20
- - lib/fprinter/screen.rb
21
20
  - lib/fprinter/display_change.rb
22
21
  - lib/fprinter/printer_change.rb
22
+ - lib/fprinter/screen.rb
23
23
  homepage: https://github.com/thomasstephane/fprinter
24
24
  licenses: []
25
25
  metadata: {}
26
- post_install_message: ! "********************************************************************************\n\n
27
- \ Follow @thomasstephn on Twitter for updates, and news.\n https://twitter.com/thomasstephn\n\n
28
- \ Thanks for using fprinter !\n\n********************************************************************************\n"
26
+ post_install_message: |
27
+ ********************************************************************************
28
+
29
+ Follow @thomasstephn on Twitter for updates, and news.
30
+ https://twitter.com/thomasstephn
31
+
32
+ Thanks for using fprinter !
33
+
34
+ ********************************************************************************
29
35
  rdoc_options: []
30
36
  require_paths:
31
37
  - lib
32
38
  required_ruby_version: !ruby/object:Gem::Requirement
33
39
  requirements:
34
- - - ! '>='
40
+ - - ">="
35
41
  - !ruby/object:Gem::Version
36
42
  version: '0'
37
43
  required_rubygems_version: !ruby/object:Gem::Requirement
38
44
  requirements:
39
- - - ! '>='
45
+ - - ">="
40
46
  - !ruby/object:Gem::Version
41
47
  version: '0'
42
48
  requirements: []
43
49
  rubyforge_project:
44
- rubygems_version: 2.0.3
50
+ rubygems_version: 2.4.3
45
51
  signing_key:
46
52
  specification_version: 4
47
53
  summary: Fancy Printer - also known as F*^$:#` Printer
48
54
  test_files: []
55
+ has_rdoc: