storable 0.9.pre.RC1 → 0.9.pre.RC2
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/README.md +1 -1
- data/lib/proc_source.rb +20 -15
- data/storable.gemspec +5 -1
- 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: 1fe040169d9300d29f3a00c5e46e74580a6f5a124b6dabda16ad3a8132d5a6eb
|
|
4
|
+
data.tar.gz: 24de9dc3bf471ef05c6aad494482925131f0b00d3a4f3dff5f478eec4b655dee
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fdaa8dc26da7cf8163dcb1d5d6249a894816445fdf0309bff690e0fc70cc13b637bf3d9ae0557d5eec2a6cabe32986b318a683b3529b0fdee466b733e1c11afb
|
|
7
|
+
data.tar.gz: 363d57e409178dac08aac9809768d6a1cfb7e4bccf2056be267da51718cc505219eb5a182a41cb3b87be2d5b4d569506dbbe473ee082e4ce8c3162f9cd9ccda7
|
data/README.md
CHANGED
data/lib/proc_source.rb
CHANGED
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
# https://github.com/notro/storable
|
|
8
8
|
#
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
# RubyToken was removed in Ruby 2.7
|
|
11
|
+
if RUBY_VERSION < "2.7"
|
|
12
|
+
require 'irb/ruby-token'
|
|
13
|
+
else
|
|
14
|
+
require './lib/core_ext.rb'
|
|
14
15
|
end
|
|
15
16
|
|
|
16
17
|
require 'irb/ruby-lex'
|
|
18
|
+
require 'pry'
|
|
17
19
|
require 'stringio'
|
|
18
20
|
|
|
19
21
|
SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
|
|
@@ -23,11 +25,9 @@ class ProcString < String
|
|
|
23
25
|
# Filename where the proc is defined
|
|
24
26
|
attr_accessor :file
|
|
25
27
|
|
|
26
|
-
# Range of lines where the proc is defined
|
|
27
|
-
# ex. (12..16)
|
|
28
|
+
# Range of lines where the proc is defined. e.g. (12..16)
|
|
28
29
|
attr_accessor :lines
|
|
29
|
-
|
|
30
|
-
attr_accessor :arity, :kind # :nodoc: FIXME: Should be removed?
|
|
30
|
+
attr_accessor :arity, :kind
|
|
31
31
|
|
|
32
32
|
# Return a Proc object
|
|
33
33
|
# If #lines and #file is specified, these are tied to the proc.
|
|
@@ -49,7 +49,6 @@ class ProcString < String
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
class RubyToken::Token
|
|
52
|
-
|
|
53
52
|
# These EXPR_BEG tokens don't have associated end tags
|
|
54
53
|
FAKIES = [
|
|
55
54
|
RubyToken::TkWHEN,
|
|
@@ -82,13 +81,11 @@ end
|
|
|
82
81
|
# Big thanks to the imedo dev team!
|
|
83
82
|
#
|
|
84
83
|
module ProcSource
|
|
85
|
-
|
|
86
84
|
def self.find(filename, start_line=1, block_only=true)
|
|
87
85
|
lines, lexer = nil, nil
|
|
88
86
|
retried = 0
|
|
89
87
|
loop do
|
|
90
88
|
lines = get_lines(filename, start_line)
|
|
91
|
-
# binding.pry
|
|
92
89
|
return nil if lines.nil?
|
|
93
90
|
if !line_has_open?(lines.join) && start_line >= 0
|
|
94
91
|
start_line -= 1 and retried +=1 and redo
|
|
@@ -99,7 +96,18 @@ module ProcSource
|
|
|
99
96
|
end
|
|
100
97
|
|
|
101
98
|
stoken, etoken, nesting = nil, nil, 0
|
|
102
|
-
|
|
99
|
+
|
|
100
|
+
binding.pry
|
|
101
|
+
if RUBY_VERSION < "2.7"
|
|
102
|
+
tokens = lexer.instance_variable_get '@OP'
|
|
103
|
+
else
|
|
104
|
+
lexer.lex
|
|
105
|
+
tokens = lexer.instance_variable_get '@tokens'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# tokens.each
|
|
109
|
+
|
|
110
|
+
while (token = lexer.token) do
|
|
103
111
|
if RubyToken::TkIDENTIFIER === token
|
|
104
112
|
# nothing
|
|
105
113
|
elsif token.open_tag? || RubyToken::TkfLBRACE === token
|
|
@@ -122,8 +130,6 @@ module ProcSource
|
|
|
122
130
|
end
|
|
123
131
|
end
|
|
124
132
|
|
|
125
|
-
# binding.pry
|
|
126
|
-
|
|
127
133
|
lines = lines[stoken.line_no-1 .. etoken.line_no-1]
|
|
128
134
|
|
|
129
135
|
# Remove the crud before the block definition.
|
|
@@ -313,4 +319,3 @@ if $0 == __FILE__
|
|
|
313
319
|
proc.call(1)
|
|
314
320
|
end
|
|
315
321
|
|
|
316
|
-
|
data/storable.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
|
2
2
|
s.name = "storable"
|
|
3
|
-
s.version = "0.9-
|
|
3
|
+
s.version = "0.9-RC2"
|
|
4
4
|
s.summary = "Ruby classes as strings"
|
|
5
5
|
s.description = "Storable: Marshal Ruby classes into and out of multiple formats (yaml, json, csv, tsv)"
|
|
6
6
|
s.authors = ["Delano Mandelbaum"]
|
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
s.files = %w(
|
|
11
11
|
README.md
|
|
12
12
|
Rakefile
|
|
13
|
+
bin/example
|
|
14
|
+
bin/tryouts
|
|
13
15
|
lib/core_ext.rb
|
|
14
16
|
lib/proc_source.rb
|
|
15
17
|
lib/storable.rb
|
|
16
18
|
lib/storable/orderedhash.rb
|
|
17
19
|
storable.gemspec
|
|
18
20
|
)
|
|
21
|
+
s.executables = %w(
|
|
22
|
+
)
|
|
19
23
|
s.extra_rdoc_files = %w[README.md]
|
|
20
24
|
s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.md"]
|
|
21
25
|
s.require_paths = %w[lib]
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: storable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.pre.
|
|
4
|
+
version: 0.9.pre.RC2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Delano Mandelbaum
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-07-
|
|
11
|
+
date: 2021-07-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: 'Storable: Marshal Ruby classes into and out of multiple formats (yaml,
|
|
14
14
|
json, csv, tsv)'
|