Module: Ripl::Johnson::Completion
- Defined in:
- lib/ripl/johnson/completion.rb
Constant Summary collapse
- RESERVED_WORDS =
%w{break case catch continue default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with debugger true false null}
- OBJECTS =
%w{Boolean Number String Array Object Function RegExp Date Error EvalError RangeError ReferenceError SyntaxError TypeError URIError decodeURI decodeURIComponent encodeURI encodeURIComponent eval isFinite isNaN parseFloat parseInt Infinity Math NaN undefined}
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.default_action ⇒ Object
23 24 25 |
# File 'lib/ripl/johnson/completion.rb', line 23 def self.default_action RESERVED_WORDS + OBJECTS + locals end |
.locals ⇒ Object
27 28 29 30 31 |
# File 'lib/ripl/johnson/completion.rb', line 27 def self.locals Ripl::Johnson.runtime.evaluate( "(function() { var arr = []; for(var e in this) { arr.push(e) }; return arr })();" ).to_a end |
.start ⇒ Object
19 20 21 |
# File 'lib/ripl/johnson/completion.rb', line 19 def self.start Bond.start(:default_mission=>lambda {|e| Ripl::Johnson::Completion.default_action }) end |
Instance Method Details
#before_loop ⇒ Object
3 4 5 6 |
# File 'lib/ripl/johnson/completion.rb', line 3 def before_loop super Ripl::Johnson::Completion.start end |