hiro_format 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/lib/hiro_format/coloring.rb +2 -1
- data/lib/hiro_format/version.rb +1 -1
- data/sample_coloring.rb +13 -0
- data/sample_formatting.rb +0 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2820745f5990c44de386797e905101cdbb1892a3
|
4
|
+
data.tar.gz: 02c1dfab0c35fc3894f17f8f179e63a698b935ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9eeeb9e50088f4d52a8008e88c38f41623d3e34a5a5d5822b164542116602498ae2dc2315db1be5b3ce90dd4d669331e1e92a54f8a704cc7215561b7eb52b8d7
|
7
|
+
data.tar.gz: 2fd0803eb60e7ac9a50bf2248abdee4a5b26072a1349b2c2354f5f80857de30b44ac8bd51b5086b45cfd17a4f578132c7d452d553a67c60f2560a625c20975da
|
data/README.md
CHANGED
@@ -34,12 +34,21 @@ Or install it yourself as:
|
|
34
34
|
|
35
35
|
$ gem install hiro_format
|
36
36
|
|
37
|
-
## Usage
|
37
|
+
## Usage - Coloring, Command line application
|
38
38
|
|
39
39
|
~~~ruby
|
40
|
-
require 'hiro_format'
|
40
|
+
require 'hiro_format/coloring'
|
41
41
|
|
42
42
|
puts "This is a text string".color(:red_marker).to_s
|
43
|
+
puts AnsiColoring.new("This is a text string", :blue_marker).to_s
|
44
|
+
~~~
|
45
|
+
|
46
|
+
|
47
|
+
## Usage - Formatting + coloring, Command line application
|
48
|
+
|
49
|
+
~~~ruby
|
50
|
+
require 'hiro_format'
|
51
|
+
|
43
52
|
value = 123456.78
|
44
53
|
puts value.formatting(:commify).color(:blue).to_s # 123,456.78 (Blue color)
|
45
54
|
puts value.formatting(:euro_commify).color(:red).to_s # 123.456,78 (Red color)
|
@@ -47,7 +56,6 @@ puts value.formatting(:euro).to_s # € 123.456,78
|
|
47
56
|
|
48
57
|
puts Formatting.new(Date.today, :jp_date).color(:magenta_marker).to_s # 2017-12-24
|
49
58
|
puts Date.today.formatting(:euro_date).color(:reverse).to_s # 24-12-2017
|
50
|
-
puts Formatting.new(Date.today, :us_date).color("magenta").to_span # <span class="magenta">12-24-2017</span>
|
51
59
|
# pzm means Plus/Zero/Minus
|
52
60
|
puts -1.formatting(:digit6).pzm?(12, [:green, :hide, :red]).to_s # -01 (Green)
|
53
61
|
puts 0.formatting(:digit6).pzm?(0, [:green, :hide, :red]).to_s # (No show)
|
@@ -56,6 +64,13 @@ puts 1.formatting(:digit6).pzm([:green, :hide, :red]).to_s # 000002 (Green)
|
|
56
64
|
|
57
65
|
See formatting_sample.rb for more examples.
|
58
66
|
|
67
|
+
## Usage - Formatting, html application
|
68
|
+
|
69
|
+
~~~ruby
|
70
|
+
require 'hiro_format'
|
71
|
+
|
72
|
+
puts Formatting.new(Date.today, :us_date).color("magenta").to_span # <span class="magenta">12-24-2017</span>
|
73
|
+
~~~
|
59
74
|
|
60
75
|
## Usage hint for Active Record / Sequel users
|
61
76
|
|
data/lib/hiro_format/coloring.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# HiroTools Formatter -
|
3
|
+
# HiroTools Formatter - AnsiColoring
|
4
4
|
#
|
5
5
|
# Hiro Utsumi (Github: Gambaldia)- Zolder Belgium
|
6
6
|
#
|
@@ -79,6 +79,7 @@
|
|
79
79
|
"\033[#{COLOR_SCHEMES[color_scheme]}m#{data}\033[0m"
|
80
80
|
end
|
81
81
|
end
|
82
|
+
alias :show :colorize
|
82
83
|
|
83
84
|
def self.show_list
|
84
85
|
puts "Color scheme list:"
|
data/lib/hiro_format/version.rb
CHANGED
data/sample_coloring.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# Formatting Class Usage Example
|
4
|
+
#
|
5
|
+
# 2017-07-29 Start
|
6
|
+
#
|
7
|
+
|
8
|
+
APP_ROOT = File.dirname(__FILE__)
|
9
|
+
$LOAD_PATH << "#{APP_ROOT}/lib"
|
10
|
+
require "hiro_format/coloring"
|
11
|
+
|
12
|
+
puts "This is a text string".color(:red_marker).to_s
|
13
|
+
puts AnsiColoring.new("This is a text string", :blue_marker).to_s
|
data/sample_formatting.rb
CHANGED
@@ -2,9 +2,6 @@
|
|
2
2
|
#
|
3
3
|
# Formatting Class Usage Example
|
4
4
|
#
|
5
|
-
# Hiro Utsumi (Github: Gambaldia) - Zolder, Belgium
|
6
|
-
#
|
7
|
-
#
|
8
5
|
# 2017-07-24 Start
|
9
6
|
#
|
10
7
|
|
@@ -13,7 +10,6 @@ APP_ROOT = File.dirname(__FILE__)
|
|
13
10
|
$LOAD_PATH << "#{APP_ROOT}/lib"
|
14
11
|
require "hiro_format/formatting"
|
15
12
|
require "hiro_format/coloring"
|
16
|
-
# require "pry" # gem install pry pry-byebug
|
17
13
|
|
18
14
|
values = [1234567890.1234, 0]
|
19
15
|
values.each do |value|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiro_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiro Utsumi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/hiro_format/formatting.rb
|
60
60
|
- lib/hiro_format/version.rb
|
61
61
|
- sample_active_record.rb
|
62
|
+
- sample_coloring.rb
|
62
63
|
- sample_formatting.rb
|
63
64
|
homepage: https://github.com/gambaldia/hiro_format.git
|
64
65
|
licenses: []
|