robust_excel_ole 1.23 → 1.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d73c62c763182694dfebd8d6c08aff0c4202752cb27dd7d8b7b46f6c1960ca4d
4
- data.tar.gz: f3381ababd070bf4f9c19a7a244d7a763d4bb97893c75b36770e27ee0b051bc5
3
+ metadata.gz: f7d0cb1b064c701e9a0cafbc632baceca0e69a4aeb47a6eba5ddcec109f27dee
4
+ data.tar.gz: f565901c9fa35233a7668958fd78ccf008e9ceb333e701e0662a850a9b5806e0
5
5
  SHA512:
6
- metadata.gz: 86e25e6d15f705b8a44058050d2a6360da2581a72855ed552a8f30958a6da707fcddb18d661416b63fa721e864bc57e6ee4102ca7a4d5569182569353538e38a
7
- data.tar.gz: 28daa6be28ba71b70ece8a387cac4e06441232e5ada825970338faaf4e0a269da1c32a471ea0d38eaa2c704f438281be7db127a8a7a257d2aa4b79d784f4547a
6
+ metadata.gz: 69aebb4f2b71f46fbf58f3b9884a11347893b3335a32690b536c2174102fadf0971cb3074f8140feedaa8a4ef91683c79c67b77192c64b846bb310ba2bda20fa
7
+ data.tar.gz: 06bee2e7e0f277e2e647de1c4281a1961649b9d22128b76389873c03f86c7baf5f8c9681e030b735a29c2358b949bdc7ac54133e74b01adb6750e9368b2daffd
@@ -64,7 +64,15 @@ If you want to start the console under jruby, and if you don't want to use a ver
64
64
 
65
65
  jreo
66
66
 
67
- The call of the console will include RobustExcelOle for you. The consoles require the ruby gem 'pry'. If you want to use the nice feature of filename and string completion, you may install pry-bond as well.
67
+ The call of the console will include RobustExcelOle for you. The consoles require the ruby gem 'pry' and 'pry-bond' to enable the ruby shell 'pry' with filename and string completion. The ruby shell 'pry' allows, among other useful things, to change the value of 'self' in the console: Let 'object' be an (almost) arbitrary object, e.g. a workbook, then you can put
68
+
69
+ object.pry
70
+
71
+ or
72
+
73
+ cd object
74
+
75
+ to assign self to this object. The original pry console is adapted to preserve local variables.
68
76
 
69
77
  The following examples can be used for both scripts and console. If you have started the console in the gem path, you can just put these examples.
70
78
 
@@ -4,6 +4,67 @@ require '../robust_excel_ole/lib/robust_excel_ole'
4
4
  include REO
5
5
  include General
6
6
 
7
+ # pry mit behalten lokaler Variablen
8
+
9
+ class Object
10
+
11
+ def pry(object = nil, hash = {})
12
+ @local_vars ||= { }
13
+ if object.nil? || Hash === object # rubocop:disable Style/CaseEquality
14
+ Pry.start(self, object || {})
15
+ else
16
+ Pry.start(object, hash)
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ class Pry
23
+
24
+ def self.set_local_vars local_vars
25
+ @local_vars = local_vars
26
+ end
27
+
28
+ def self.get_local_vars
29
+ @local_vars
30
+ end
31
+
32
+ def self.binding_for(target)
33
+ return target if Binding === target # rubocop:disable Style/CaseEquality
34
+ return TOPLEVEL_BINDING if Pry.main == target
35
+ __bnd = target.instance_eval{ target.__binding__ }
36
+ @local_vars.each{ |var,value| __bnd.local_variable_set(var, value) }
37
+ #target.__binding__
38
+ __bnd
39
+ end
40
+
41
+ class REPL
42
+
43
+ def repl
44
+ loop do
45
+ case val = read
46
+ when :control_c
47
+ output.puts ""
48
+ pry.reset_eval_string
49
+ when :no_more_input
50
+ output.puts "" if output.tty?
51
+ break
52
+ else
53
+ output.puts "" if val.nil? && output.tty?
54
+ # determine the local variables in the binding before evaluation
55
+ bnd = pry.binding_stack.first
56
+ exclude_vars = [:__, :_, :_dir, :_dir_, :_file, :_file_, :_in_, :_out_, :_ex, :_ex_, :pry_instance]
57
+ local_vars = Pry.get_local_vars
58
+ bnd.local_variables.each{ |var| local_vars[var] = bnd.local_variable_get(var) unless exclude_vars.include?(var) }
59
+ Pry.set_local_vars(local_vars)
60
+ return pry.exit_value unless pry.eval(val)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+
7
68
  # some pry configuration
8
69
  Pry.config.windows_console_warning = false
9
70
  Pry.config.color = false
@@ -12,6 +73,21 @@ Pry.config.prompt_name = "REO "
12
73
  #Pry.config.history_save = true
13
74
  #Pry.editor = 'notepad' # 'subl', 'vi'
14
75
 
76
+ Pry.config.prompt = Pry::Prompt.new(
77
+ "REO",
78
+ "The RobustExcelOle Prompt. Besides the standard information it puts the current object",
79
+ [
80
+ proc { |target_self, nest_level, pry|
81
+ "[#{pry.input_ring.count}] #{pry.config.prompt_name}(#{Pry.view_clip(target_self.inspect)})#{":#{nest_level}" unless nest_level.zero?}> "
82
+ },
83
+
84
+ proc { |target_self, nest_level, pry|
85
+ "[#{pry.input_ring.count}] #{pry.config.prompt_name}(#{Pry.view_clip(target_self.inspect)})#{":#{nest_level}" unless nest_level.zero?}* "
86
+ }
87
+ ]
88
+ )
89
+
90
+
15
91
  hooks = Pry::Hooks.new
16
92
 
17
93
  hooks.add_hook :when_started, :hook12 do
@@ -142,16 +142,33 @@ class WIN32OLE
142
142
  raise TypeREOError, "given object cannot be type-lifted to a RobustExcelOle object"
143
143
  end
144
144
 
145
- alias method_missing_before_implicit_typelift method_missing
146
- def xx_method_missing(name, *args, &blk)
147
- begin
148
- reo_obj = self.to_reo
149
- rescue
150
- puts "$!.message: #{$!.message}"
151
- method_missing_before_implicit_typelift(name, *args, &blk)
152
- end
153
- reo_obj.send(name, *args, &blk)
154
- end
145
+
146
+ # def method_missing(name, *args, &blk)
147
+ # puts "method_missing:"
148
+ # puts "name: #{name.inspect}"
149
+ # puts "self: #{self}"
150
+ # puts "self.ole_type: #{self.ole_type}"
151
+ # puts "self.to_reo: #{self.to_reo}"
152
+ # begin
153
+ # reo_obj = self.to_reo
154
+ # rescue
155
+ # puts "error: #{$!.message}"
156
+ # raise # NoMethodError, "undefined method #{name.inspect} for #{self.inspect}"
157
+ # end
158
+ # reo_obj.send(name, *args, &blk)
159
+ # end
160
+
161
+ #alias method_missing_before_implicit_typelift method_missing
162
+ #def method_missing(name, *args, &blk)
163
+ # begin
164
+ # reo_obj = self.to_reo
165
+ # rescue
166
+ # puts "$!.message: #{$!.message}"
167
+ # method_missing_before_implicit_typelift(name, *args, &blk)
168
+ # end
169
+ # reo_obj.send(name, *args, &blk)
170
+ #end
171
+
155
172
  end
156
173
 
157
174
  # @private
@@ -1,3 +1,3 @@
1
1
  module RobustExcelOle
2
- VERSION = "1.23"
2
+ VERSION = "1.24"
3
3
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
35
35
  s.require_paths = ["lib"]
36
36
  s.add_runtime_dependency "pry", '>= 0.12.1'
37
- s.add_runtime_dependency "pry-bond", '>=0.01'
37
+ s.add_runtime_dependency "pry-bond", '>=0.0.1'
38
38
  s.add_development_dependency "rspec", '>= 2.6.0'
39
39
  s.required_ruby_version = '>= 2.1'
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: robust_excel_ole
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.23'
4
+ version: '1.24'
5
5
  platform: ruby
6
6
  authors:
7
7
  - traths
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-04 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0.01'
33
+ version: 0.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0.01'
40
+ version: 0.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement