Class: RVC::RubyEvaluator
- Inherits:
-
Object
- Object
- RVC::RubyEvaluator
show all
- Defined in:
- lib/rvc/shell.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RubyEvaluator.
181
182
183
184
|
# File 'lib/rvc/shell.rb', line 181
def initialize fs
@binding = binding
@fs = fs
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *a) ⇒ Object
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
|
# File 'lib/rvc/shell.rb', line 202
def method_missing sym, *a
str = sym.to_s
if a.empty?
if MODULES.member? str
MODULES[str]
elsif @fs.marks.member?(str)
@fs.marks[str].obj
elsif str[0..0] == '_' && @fs.marks.member?(str[1..-1])
@fs.marks[str[1..-1]].obj
else
super
end
else
super
end
end
|
Instance Method Details
#conn ⇒ Object
198
199
200
|
# File 'lib/rvc/shell.rb', line 198
def conn
@fs.lookup("~@").first
end
|
#dc ⇒ Object
194
195
196
|
# File 'lib/rvc/shell.rb', line 194
def dc
@fs.lookup("~").first
end
|
#do_eval(input) ⇒ Object
186
187
188
|
# File 'lib/rvc/shell.rb', line 186
def do_eval input
eval input, @binding
end
|
#this ⇒ Object
190
191
192
|
# File 'lib/rvc/shell.rb', line 190
def this
@fs.cur
end
|