lib/expectr/interpreter.rb in expectr-2.0.0 vs lib/expectr/interpreter.rb in expectr-2.0.1
- old
+ new
@@ -7,21 +7,20 @@
DEFAULT_TIMEOUT = 10
# Public: Filename of currently executing script.
attr_accessor :filename
- # Public: Initialize a new Expectr interface.
+ # Public: Initialize a new Expectr Interpreter interface.
#
# source - String containing the source to be executed.
def initialize(source)
@source = source
@variables = { timeout: DEFAULT_TIMEOUT }
@expect = nil
end
- # Public: Run the source associated with the Interface object, bound to the
- # Object.
+ # Public: Run the source associated with the Interface object.
#
# Returns nothing.
def run
eval(@source, binding, (@filename || "(expectr)"), 0)
end
@@ -43,10 +42,10 @@
# In order to keep compatibility with Expect, a Fixnum can be
# passed, such that any number greater than 0 is evaluated as
# true, and 0 or less is false.
#
# Returns nothing.
- # Raises Argument
+ # Raises TypeError if enable is not a boolean.
def log_user(enable)
if enable.is_a?(Numeric)
enable = (enable > 0)
end
unless enable.is_a?(TrueClass) || enable.is_a?(FalseClass)