opal-irb 0.8.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  class OpalIrb
2
- VERSION = '0.8.1'
2
+ VERSION = '0.10.0'
3
3
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.files = `git ls-files`.split("\n")
14
14
  s.require_paths = ['lib']
15
15
 
16
- s.add_dependency 'opal', '~> 0.8.0'
17
- s.add_dependency 'opal-jquery', '~> 0.4.0'
16
+ s.add_dependency 'opal', '~> 0.10.6'
17
+ s.add_dependency 'opal-jquery', '~> 0.4.2'
18
18
 
19
19
  s.add_development_dependency 'rake'
20
20
  end
@@ -90,8 +90,11 @@ class OpalIrb
90
90
  classes = []
91
91
  $opal_js_object = Native(`Opal`) # have to make this global right now coz not seen in the each closure w/current opal
92
92
  $opal_js_object.each {|k|
93
- attr = $opal_js_object[k]
94
- classes << attr if attr.is_a?(Class)
93
+ begin
94
+ attr = $opal_js_object[k] # sometimes "NoMethodError: undefined method `is_a?' for BasicObject" happened
95
+ classes << attr if attr.is_a?(Class)
96
+ rescue => _e
97
+ end
95
98
  }
96
99
  classes.uniq.sort_by { |cls| cls.name } # coz some Opal classes are the same, i.e. module == class, base, Kernel = Object
97
100
  end
@@ -30,26 +30,27 @@ class OpalIrb
30
30
 
31
31
  def common_prefix_if_exists(orig_text, match_index, results)
32
32
  working_copy = results.clone
33
- first_word = working_copy.shift
33
+ chars = common_chars_in_prefix(working_copy)
34
+ common = chars.join
35
+ CompletionEngine.debug_puts "\torig_text: |#{orig_text}| common prefix: #{common} match_index: #{match_index}"
36
+ match_index == 0 ? common : orig_text[0..match_index-1] + common
37
+ end
38
+
39
+ def common_chars_in_prefix(words)
40
+ first_word = words.shift
34
41
  chars = []
35
42
  i = 0
36
- # first_word.each_char { |char|
37
- letters = [] #- break is broken on 0.8.0 beta for each_char
38
- first_word.each_char { |char| letters << char }
39
- letters.each { |char|
40
- if working_copy.all? { |str| str[i] == char }
43
+ first_word.each_char { |char|
44
+ if words.all? { |str| str[i] == char }
41
45
  chars << char
42
46
  i += 1
43
47
  else
44
- break
48
+ return chars
45
49
  end
46
50
  }
47
- common = chars.join
48
- CompletionEngine.debug_puts "\torig_text: |#{orig_text}| common prefix: #{common} match_index: #{match_index}"
49
- match_index == 0 ? common : orig_text[0..match_index-1] + common
51
+ chars
50
52
  end
51
53
 
52
-
53
54
  def old_prompt?
54
55
  @old_prompt
55
56
  end
metadata CHANGED
@@ -1,62 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
5
- prerelease:
4
+ version: 0.10.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Forrest Chang
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: opal
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 0.8.0
19
+ version: 0.10.6
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: 0.8.0
26
+ version: 0.10.6
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: opal-jquery
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: 0.4.0
33
+ version: 0.4.2
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: 0.4.0
40
+ version: 0.4.2
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  description: Irb and more for Opal
@@ -65,9 +58,9 @@ executables: []
65
58
  extensions: []
66
59
  extra_rdoc_files: []
67
60
  files:
68
- - .gitignore
69
- - .ruby-gemset
70
- - .ruby-version
61
+ - ".gitignore"
62
+ - ".ruby-gemset"
63
+ - ".ruby-version"
71
64
  - Changelog.org
72
65
  - Gemfile
73
66
  - Gemfile.lock
@@ -122,32 +115,25 @@ files:
122
115
  - spec/spec_helper.rb
123
116
  homepage: https://github.com/fkchang/opal-irb
124
117
  licenses: []
118
+ metadata: {}
125
119
  post_install_message:
126
120
  rdoc_options: []
127
121
  require_paths:
128
122
  - lib
129
123
  required_ruby_version: !ruby/object:Gem::Requirement
130
- none: false
131
124
  requirements:
132
- - - ! '>='
125
+ - - ">="
133
126
  - !ruby/object:Gem::Version
134
127
  version: '0'
135
- segments:
136
- - 0
137
- hash: 848123283666491420
138
128
  required_rubygems_version: !ruby/object:Gem::Requirement
139
- none: false
140
129
  requirements:
141
- - - ! '>='
130
+ - - ">="
142
131
  - !ruby/object:Gem::Version
143
132
  version: '0'
144
- segments:
145
- - 0
146
- hash: 848123283666491420
147
133
  requirements: []
148
134
  rubyforge_project:
149
- rubygems_version: 1.8.23.2
135
+ rubygems_version: 2.7.7
150
136
  signing_key:
151
- specification_version: 3
137
+ specification_version: 4
152
138
  summary: Irb and more for Opal
153
139
  test_files: []