ruval 0.1.4 → 0.1.5

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49449ee893798027cc9863a8bebc20f2f3ea205f7b10307e0aced32c40a123b6
4
- data.tar.gz: 03fd6bf527508e2fd4bc9e232d732edfc05dda78313bdfe12c46eab030135f5c
3
+ metadata.gz: 43ddb4cd97827b47d98782f74a8787e4ade6359dd7c517ff4c783932e966741b
4
+ data.tar.gz: 2008faeca570a7cebd3e911c0c2526e76c6218a7f1a8c12bfdf9f08b3e886561
5
5
  SHA512:
6
- metadata.gz: 5cad3eff85b590f428474a33156247f2d84e8c64594a53f6f7f547a845a4e2e356e25d600f200300de755e4db62513bd7bf70c2c65940056ee115a937a956bef
7
- data.tar.gz: 896269bed7361a5a6c1aaa42796eb5bce1e2140cafb3535b5e59d67f162624598754c57bb489ebd980cbfdaac2fff1e2ab0bdad9e17705662665f63ee53733e5
6
+ metadata.gz: dc8f0326c17468d41f7a49f17466b21dfdfd37e6e9b21849cf997f3a888707210e9694cbd4494e6e52c8c27307a1069ecf126bfc4ba72551487e19abacdd3219
7
+ data.tar.gz: a302f41c9be53069e9f9bd3603f219c86b049035357eeaad03fced72268c4e177192de8ec015973b2dce7d14487ed46e38ff33e264510f05dc501ab2f9c9df7d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruval (0.1.4)
4
+ ruval (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [ ] ignore keywords inside strings. Eg the parenthesis in this line causes problems:
4
4
  def good; ':)'; end
5
+ [x] add option '-c' to colorize (with green) the returned values
5
6
 
6
7
  # Ruval
7
8
 
@@ -47,17 +47,20 @@ end
47
47
 
48
48
  file = ARGV.shift
49
49
 
50
+ opts = {}
50
51
  if ARGV.include?('-n')
51
- _, line_spacing = ARGV[ARGV.index('-n'),2]
52
- line_spacing = line_spacing.to_i
52
+ _, opts[:line_spacing]= ARGV[ARGV.index('-n'),2]
53
+ opts[:line_spacing] = opts[:line_spacing].to_i
53
54
  end
54
- line_spacing ||= DEFAULT_NEWLINES
55
+ opts[:line_spacing] ||= DEFAULT_NEWLINES
55
56
 
56
- if line_spacing < 0
57
+ if opts[:line_spacing] < 0
57
58
  puts "line_spacing cannot be negative"
58
59
  exit
59
60
  end
60
61
 
62
+ opts[:colorize] = ARGV.include?('-c') ? true : false
63
+
61
64
  # get longest line
62
65
  longest = 0
63
66
  File.read(file).each_line do |l|
@@ -86,7 +89,7 @@ File.read(file).each_line do |l|
86
89
  update_scope(l, line_stack, scope)
87
90
  next if(comment?(l) || l.strip.empty? || !scope.empty?)
88
91
  l = if line_stack.empty?
89
- line_spacing == 0 ? l.remove_comments(longest) : l
92
+ opts[:line_spacing] == 0 ? l.remove_comments(longest) : l
90
93
  else
91
94
  line_stack.slice!(0,line_stack.length).join
92
95
  end
@@ -98,6 +101,7 @@ File.read(file).each_line do |l|
98
101
  else
99
102
  value
100
103
  end
101
- puts l + "=> #{value}" + "\n"*line_spacing
104
+ color = opts[:colorize] ? "\e[32m" : "\e[m"
105
+ puts l + "#{color}=> #{value}\e[m" + "\n" * opts[:line_spacing]
102
106
  end
103
107
 
@@ -1,3 +1,3 @@
1
1
  module Ruval
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruval
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-20 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Print the value of every statement in a Ruby progam
14
14
  email:
@@ -33,11 +33,11 @@ files:
33
33
  - lib/ruval.rb
34
34
  - lib/ruval/version.rb
35
35
  - ruval.gemspec
36
- homepage:
36
+ homepage:
37
37
  licenses:
38
38
  - MIT
39
39
  metadata: {}
40
- post_install_message:
40
+ post_install_message:
41
41
  rdoc_options: []
42
42
  require_paths:
43
43
  - lib
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  requirements: []
55
55
  rubygems_version: 3.1.4
56
- signing_key:
56
+ signing_key:
57
57
  specification_version: 4
58
58
  summary: Print the value of every statement in a Ruby progam
59
59
  test_files: []