Namespace

Class/Module Index [+]

Quicksearch

Webgen::Common

Namespace for classes and methods that provide common functionality.

Public Class Methods

const_for_name(name) click to toggle source

Return the constant object for the given absolute constant name.

# File lib/webgen/common.rb, line 10
def self.const_for_name(name)
  name.split('::').inject(Object) {|b,n| b.const_get(n)}
end
error_file(error) click to toggle source

Return the file name where the error occured.

# File lib/webgen/common.rb, line 20
def self.error_file(error)
  (error.is_a?(::SyntaxError) ? error.message : error.backtrace[0]).scan(/(?:^|\s)(.*?):(\d+)/).first.first
end
error_line(error) click to toggle source

Return the error line by inspecting the backtrace of the given error instance.

# File lib/webgen/common.rb, line 15
def self.error_line(error)
  (error.is_a?(::SyntaxError) ? error.message : error.backtrace[0]).scan(/:(\d+)/).first.first.to_i rescue nil
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.