Skip to content

Commit

Permalink
removed trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Burke Libbey committed Mar 3, 2012
1 parent 69bf713 commit 27af857
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions lib/wolverine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
module Wolverine
# Returns the configuration object for reading and writing
# configuration values.
#
#
# @return [Wolverine::Configuration] the configuration object
def self.config
@config ||= Configuration.new
Expand All @@ -35,13 +35,13 @@ def self.reset!
# Used to handle dynamic accesses to scripts. Successful lookups will be
# cached on the {PathComponent} object. See {PathComponent#method_missing}
# for more detail on how this works.
#
#
# @return [PathComponent, Object] a PathComponent if the method maps to a
# directory, or an execution result if the the method maps to a lua file.
def self.method_missing sym, *args
root_directory.send(sym, *args)
root_directory.send(sym, *args)
rescue PathComponent::MissingTemplate
super
super
end

private
Expand Down
8 changes: 4 additions & 4 deletions lib/wolverine/lua_error.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module Wolverine
# Reformats errors raised by redis representing failures while executing
# a lua script. The default errors have confusing messages and backtraces,
# and a type of +RuntimeError+. This class improves the message and
# and a type of +RuntimeError+. This class improves the message and
# modifies the backtrace to include the lua script itself in a reasonable
# way.
class LuaError < StandardError
PATTERN = /ERR Error (compiling|running) script \(.*?\): \[.*?\]:(\d+): (.*)/
WOLVERINE_LIB_PATH = File.expand_path('../../', __FILE__)

# Is this error one that should be reformatted?
#
#
# @param error [StandardError] the original error raised by redis
# @return [Boolean] is this an error that should be reformatted?
def self.intercepts? error
Expand All @@ -18,7 +18,7 @@ def self.intercepts? error

# Initialize a new {LuaError} from an existing redis error, adjusting
# the message and backtrace in the process.
#
#
# @param error [StandardError] the original error raised by redis
# @param file [Pathname] full path to the lua file the error ocurred in
def initialize error, file
Expand Down Expand Up @@ -52,4 +52,4 @@ def line_from_wolverine(line)

end

end
end
8 changes: 4 additions & 4 deletions lib/wolverine/path_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module Wolverine
#
# Calling a method that maps to a directory will return a new {PathComponent}
# with a +path+ referring to that directory.
#
#
# Calling a method that maps to a file (with +'.lua'+ automatically appended
# to the name) will load the file via {Script} and call it with the
# arugments passed, returning the result ({method_missing}).
class PathComponent
class PathComponent
class MissingTemplate < StandardError ; end

# @param path [Pathname] full path to the current file or directory
Expand All @@ -20,7 +20,7 @@ def initialize path

# @param sym [Symbol] the file or directory to look up and execute
# @param args [*Objects] arguments to pass to the {Script}, if +sym+ resolves to a lua file
# @return [PathComponent, Object] A new, nested {PathComponent} if +sym+ resolves to
# @return [PathComponent, Object] A new, nested {PathComponent} if +sym+ resolves to
# a directory, or an execution result if it resolves to a file.
# @raise [MissingTemplate] if +sym+ maps to neither a directory or a file
def method_missing sym, *args
Expand Down Expand Up @@ -67,4 +67,4 @@ def define_metaclass_method sym, &block

end

end
end
8 changes: 4 additions & 4 deletions lib/wolverine/script.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Wolverine
# is handled by {LuaError}.
class Script

# Loads the script file from disk and calculates its +SHA1+ sum.
#
# Loads the script file from disk and calculates its +SHA1+ sum.
#
# @param file [Pathname] the full path to the indicated file
def initialize file
@file = file
Expand All @@ -17,7 +17,7 @@ def initialize file

# Passes the script and supplied arguments to redis for evaulation.
# It first attempts to use a script redis has already cached by using
# the +EVALSHA+ command, but falls back to providing the full script
# the +EVALSHA+ command, but falls back to providing the full script
# text via +EVAL+ if redis has not seen this script before. Future
# invocations will then use +EVALSHA+ without erroring.
#
Expand All @@ -33,7 +33,7 @@ def call redis, *args
e.message =~ /NOSCRIPT/ ? run_eval(redis, *args) : raise
end
rescue => e
if LuaError.intercepts?(e)
if LuaError.intercepts?(e)
raise LuaError.new(e, @file)
else
raise
Expand Down

0 comments on commit 27af857

Please sign in to comment.