md-ruby-eval 0.5.0 → 0.6.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/md_ruby_eval.rb +8 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50a72fe6be4309793db0ef2c0a4b07d7f3f122f6b4c17fa163e4e650c1777ddc
4
- data.tar.gz: 7b6235cb501c789122e47aea7736e355510d0e6f35bcb67d86e1289058e05887
3
+ metadata.gz: bcee43bc85160295c03ead6a92de50ac348764e71b0be778a735bd37068e78f2
4
+ data.tar.gz: 80ff55a46f7e580603ce00b50e56e49fbdcb49f28c8e42c01e4cae604c9f6ef0
5
5
  SHA512:
6
- metadata.gz: fac33b73fbbad84b03c6a40225858d5650a42a4fc062f73f592f8ea8937d79abac314ad9758aab98513567a52a5886d3fd4fc166635f79c7391caaa2f8d670d7
7
- data.tar.gz: a2ba788a388490b98015d8a7bd789dfb1d7e4f6588bae4e5bd954aac459dc78b83dc6196a847e0cc54605cd25bee1dbe55a103ccdac6e2042c1e297ef7039273
6
+ metadata.gz: ea00701e71c7e88c30adcf8b68a287fc8aac8c052b4f02d6575ab2ef9712ac7798ed07d60152e1eb8e5b3185c932eb313b1e2a6b7a5d663f82d3c60aa573276c
7
+ data.tar.gz: 613c2c51ce11d41e66f23380c2ee94c6e592175671c9a9281bb5a141757a75c5413ed594f8b38a775f7d7b5ade21716495553f39f8638841bb329cbb3553bf3b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.6.0
@@ -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 = stabilize_object_ids result.inspect
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 = stabilize_object_ids 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 stabilize_object_ids(output)
82
- output.gsub(/(#<[\w:_]+0x)([0-9a-f]{16})/) { $1 + @known_ids[$2] }
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.5.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-09 00:00:00.000000000 Z
11
+ date: 2019-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry