markdown_exec 2.0.1 → 2.0.2
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 +4 -4
- data/CHANGELOG.md +1 -1
- data/Gemfile.lock +1 -1
- data/bin/tab_completion.sh +2 -2
- data/lib/hash_delegator.rb +1 -1
- data/lib/input_sequencer.rb +1 -1
- data/lib/instance_method_wrapper.rb +137 -0
- data/lib/markdown_exec/version.rb +1 -1
- data/lib/menu.yml +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece122ac9b2994b3a0ee90b6a6b07f637abd015f45b2275c0bcf740a2fbfb173
|
4
|
+
data.tar.gz: f8c79187fc3f1fb4f8d53750dbb6078cb81ab58c04114bc484cd66ed22f890a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57246f8b67613bdf55911dcc5274b7bad32b3702c3070ee75f30754ea8a816ebeee42b930bceb363313256b1b5368fd05bf2c1ccfbde545ea934d6b9d66d8e86
|
7
|
+
data.tar.gz: fefcd1ed4b825a81cd9e5bfa79c0c3124550778908ad2200dd6ac9cd5db1ba6c70d2cc4987df05700ba2dd554461fd0b39ba330a32209f2edc7a7ad80cdadff3
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/bin/tab_completion.sh
CHANGED
@@ -13,7 +13,7 @@ __filedirs_all()
|
|
13
13
|
}
|
14
14
|
|
15
15
|
_mde_echo_version() {
|
16
|
-
echo "2.0.
|
16
|
+
echo "2.0.2"
|
17
17
|
}
|
18
18
|
|
19
19
|
_mde() {
|
@@ -186,4 +186,4 @@ _mde() {
|
|
186
186
|
|
187
187
|
complete -o filenames -o nospace -F _mde mde
|
188
188
|
# _mde_echo_version
|
189
|
-
# echo "Updated: 2024-02-09 19:
|
189
|
+
# echo "Updated: 2024-02-09 19:26:00 UTC"
|
data/lib/hash_delegator.rb
CHANGED
@@ -2349,7 +2349,7 @@ require 'minitest/autorun'
|
|
2349
2349
|
require 'mocha/minitest'
|
2350
2350
|
|
2351
2351
|
####
|
2352
|
-
require_relative '
|
2352
|
+
require_relative 'instance_method_wrapper'
|
2353
2353
|
# MarkdownExec::HashDelegator.prepend(InstanceMethodWrapper)
|
2354
2354
|
# MarkdownExec::HashDelegator.singleton_class.prepend(ClassMethodWrapper)
|
2355
2355
|
|
data/lib/input_sequencer.rb
CHANGED
@@ -0,0 +1,137 @@
|
|
1
|
+
#!/usr/bin/env bundle exec ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# encoding=utf-8
|
5
|
+
|
6
|
+
$imw_depth = 0
|
7
|
+
$imw_len = 128
|
8
|
+
|
9
|
+
module ImwUx
|
10
|
+
def imw_ins(_obj = nil, _name = nil)
|
11
|
+
# warn "#{imw_indent}#{name} #{obj.inspect}"
|
12
|
+
pfx = '~ '
|
13
|
+
fl = ' '
|
14
|
+
v = '-' #inst ? '-' : '='
|
15
|
+
$imw_depth ||= 0 # Initialize $imw_depth if not already initialized
|
16
|
+
"#{fl * $imw_depth}#{pfx}" + "#{v}i#{v}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def imw_indent(dir = :in, inst = true)
|
20
|
+
pfx = '~ '
|
21
|
+
fl = ' '
|
22
|
+
inst ? '-' : '='
|
23
|
+
$imw_depth ||= 0 # Initialize $imw_depth if not already initialized
|
24
|
+
$imw_depth += 1 if dir == :in
|
25
|
+
result = "#{fl * $imw_depth}#{pfx}" + (dir == :in ? '> ' : '< ')
|
26
|
+
$imw_depth -= 1 if dir == :out
|
27
|
+
result
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
module ClassMethodWrapper
|
32
|
+
def self.prepended(base)
|
33
|
+
base.singleton_class.instance_methods(false).each do |method_name|
|
34
|
+
wrap_method(base, method_name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.wrap_method(base, method_name)
|
39
|
+
base.singleton_class.define_method(method_name) do |*args, **kwargs, &block|
|
40
|
+
method = base.method(method_name)
|
41
|
+
parameters = method.parameters.map(&:last)
|
42
|
+
|
43
|
+
warn format("%s %.#{$imw_len}s",
|
44
|
+
imw_indent(:in, false).to_s,
|
45
|
+
":i:> #{sbase}::#{method_name}: " +
|
46
|
+
[args == [] ? nil : "args=#{args.inspect}",
|
47
|
+
kwargs == {} ? nil : "kwargs=#{kwargs.inspect}"].compact.join(', '))
|
48
|
+
$imw_depth += 1
|
49
|
+
|
50
|
+
result = if parameters.include?(:key) || parameters.include?(:keyreq)
|
51
|
+
method.call(*args, **kwargs, &block)
|
52
|
+
else
|
53
|
+
method.call(*args, &block)
|
54
|
+
end
|
55
|
+
|
56
|
+
$imw_depth -= 1
|
57
|
+
warn format("%s %.#{$imw_len}s",
|
58
|
+
imw_indent(:out, false).to_s,
|
59
|
+
"<:o: #{sbase}::#{method_name}: #{result.inspect}")
|
60
|
+
result
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
module InstanceMethodWrapper
|
66
|
+
extend ImwUx # This makes imw_indent available as a class method
|
67
|
+
include ImwUx # This makes imw_indent available as a class method
|
68
|
+
|
69
|
+
def self.prepended(base)
|
70
|
+
base.instance_methods(false).each do |method_name|
|
71
|
+
wrap_method(base, method_name) unless %i[method_missing].include? method_name
|
72
|
+
end
|
73
|
+
|
74
|
+
base.singleton_class.send(:define_method, :method_added) do |method_name|
|
75
|
+
unless @_currently_adding_method
|
76
|
+
@_currently_adding_method = true
|
77
|
+
InstanceMethodWrapper.wrap_method(self, method_name)
|
78
|
+
@_currently_adding_method = false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.wrap_method(base, method_name)
|
84
|
+
sbase = base.to_s.gsub(/[a-z]/, '')
|
85
|
+
original_method = base.instance_method(method_name)
|
86
|
+
base.send(:define_method, method_name) do |*args, **kwargs, &block|
|
87
|
+
warn format("%s %.#{$imw_len}s",
|
88
|
+
imw_indent(:in).to_s,
|
89
|
+
"#{sbase}::#{method_name}: " +
|
90
|
+
[args == [] ? nil : "args=#{args.inspect}",
|
91
|
+
kwargs == {} ? nil : "kwargs=#{kwargs.inspect}"].compact.join(', '))
|
92
|
+
$imw_depth += 1
|
93
|
+
original_method.bind(self).call(*args, **kwargs, &block).tap do |result|
|
94
|
+
### if !%w[method_missing].include? method_name
|
95
|
+
$imw_depth -= 1
|
96
|
+
warn format("%s %.#{$imw_len}s",
|
97
|
+
imw_indent(:out).to_s,
|
98
|
+
"#{sbase}::#{method_name}: " +
|
99
|
+
result.inspect)
|
100
|
+
# end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
__END__
|
107
|
+
|
108
|
+
def the_method; other_method; end
|
109
|
+
def other_method; end
|
110
|
+
|
111
|
+
def start_trace
|
112
|
+
trace = TracePoint.new(:call) { |tp| p [tp.path, tp.lineno, tp.event, tp.method_id] }
|
113
|
+
|
114
|
+
trace.enable
|
115
|
+
yield
|
116
|
+
trace.disable
|
117
|
+
end
|
118
|
+
|
119
|
+
start_trace { the_method }
|
120
|
+
|
121
|
+
# EVENT NAME DESCRIPTION
|
122
|
+
# call Application methods
|
123
|
+
# c_call C-level methods (like puts)
|
124
|
+
# return Method return (for tracing return values & call depth)
|
125
|
+
# b_call Block call
|
126
|
+
# b_return Block return
|
127
|
+
# raise Exception raised
|
128
|
+
# thread_begin New thread
|
129
|
+
# thread_end Thread ending
|
130
|
+
|
131
|
+
def the_method; "A" * 10; end
|
132
|
+
|
133
|
+
trace = TracePoint.new(:return) { |tp| puts "Return value for #{tp.method_id} is #{tp.return_value}." }
|
134
|
+
|
135
|
+
trace.enable
|
136
|
+
the_method
|
137
|
+
trace.disable
|
data/lib/menu.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_exec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fareed Stevenson
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- lib/hash.rb
|
156
156
|
- lib/hash_delegator.rb
|
157
157
|
- lib/input_sequencer.rb
|
158
|
+
- lib/instance_method_wrapper.rb
|
158
159
|
- lib/link_history.rb
|
159
160
|
- lib/markdown_exec.rb
|
160
161
|
- lib/markdown_exec/version.rb
|