md-ruby-eval 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/md_ruby_eval.rb +8 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcee43bc85160295c03ead6a92de50ac348764e71b0be778a735bd37068e78f2
|
4
|
+
data.tar.gz: 80ff55a46f7e580603ce00b50e56e49fbdcb49f28c8e42c01e4cae604c9f6ef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea00701e71c7e88c30adcf8b68a287fc8aac8c052b4f02d6575ab2ef9712ac7798ed07d60152e1eb8e5b3185c932eb313b1e2a6b7a5d663f82d3c60aa573276c
|
7
|
+
data.tar.gz: 613c2c51ce11d41e66f23380c2ee94c6e592175671c9a9281bb5a141757a75c5413ed594f8b38a775f7d7b5ade21716495553f39f8638841bb329cbb3553bf3b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/md_ruby_eval.rb
CHANGED
@@ -5,7 +5,7 @@ require 'optparse'
|
|
5
5
|
class MDRubyEval
|
6
6
|
|
7
7
|
def initialize(input_path, output_path, environment, indentation, line_length, verbose)
|
8
|
-
@input_path = input_path
|
8
|
+
@input_path = File.expand_path input_path
|
9
9
|
@output_path = output_path
|
10
10
|
@environment = environment
|
11
11
|
@output = ''
|
@@ -61,12 +61,12 @@ class MDRubyEval
|
|
61
61
|
if last_line =~ /\#$/
|
62
62
|
output << last_line.gsub(/\#$/, '')
|
63
63
|
else
|
64
|
-
inspected_result =
|
64
|
+
inspected_result = normalize result.inspect
|
65
65
|
if last_line.size < @indentation && inspected_result.size < @indentation
|
66
66
|
output << "%-#{@indentation}s %s" % [last_line.chomp, "# => #{inspected_result}\n"]
|
67
67
|
else
|
68
68
|
PP.pp result, (buf = ''), @line_length
|
69
|
-
buf =
|
69
|
+
buf = normalize buf
|
70
70
|
inspect_lines = buf.lines
|
71
71
|
output << last_line << "# => #{inspect_lines[0]}" << inspect_lines[1..-1].map { |l| format '# %s', l }.join
|
72
72
|
end
|
@@ -78,8 +78,11 @@ class MDRubyEval
|
|
78
78
|
end
|
79
79
|
|
80
80
|
|
81
|
-
def
|
82
|
-
|
81
|
+
def normalize(output)
|
82
|
+
basename = File.basename(@input_path)
|
83
|
+
output.
|
84
|
+
gsub(/(#<[\w:_]+0x)([0-9a-f]{16})/) { $1 + @known_ids[$2] }.
|
85
|
+
gsub(/#{@input_path}/, basename)
|
83
86
|
end
|
84
87
|
|
85
88
|
def process_file(input_path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md-ruby-eval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Chalupa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|