class BetterRailsDebugger::Parser::Analyzer
Public Class Methods
analise(path, options)
click to toggle source
# File lib/better_rails_debugger/parser/analyzer.rb, line 9 def self.analise(path, options) self.new(path, options).run end
new(path, options)
click to toggle source
# File lib/better_rails_debugger/parser/analyzer.rb, line 4 def initialize(path, options) @path = path @options = options end
Public Instance Methods
get_lang_from_path()
click to toggle source
get file ext and return language as 'ruby', 'javascript', 'php' or nil if unknown
# File lib/better_rails_debugger/parser/analyzer.rb, line 25 def get_lang_from_path case File.extname(@path).downcase when '.rb' 'ruby' when '.js' 'javascript' when '.php' 'php' else nil end end
get_lang_instance(lang)
click to toggle source
# File lib/better_rails_debugger/parser/analyzer.rb, line 38 def get_lang_instance(lang) "BetterRailsDebugger::#{lang.classify}::Parser".constantize.new @path, @options end
run()
click to toggle source
# File lib/better_rails_debugger/parser/analyzer.rb, line 13 def run # Check if file exist or not raise ArgumentError.new "File #{@path} does not exist" if !File.exist? @path # Detect lang by file ext lang = get_lang_from_path raise ArgumentError.new "Sorry, we do not support that language" if lang != 'ruby' # Only ruby by the moment # Create lang instance with options lang_instance = get_lang_instance lang # parse end